本文整理汇总了C++中MainDialog::GetHwnd方法的典型用法代码示例。如果您正苦于以下问题:C++ MainDialog::GetHwnd方法的具体用法?C++ MainDialog::GetHwnd怎么用?C++ MainDialog::GetHwnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainDialog
的用法示例。
在下文中一共展示了MainDialog::GetHwnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wWinMain
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, INT /*nCmdShow*/)
{
// Create and show the dialog, we changed the application to support Modeless dialog
MainDialog *pDlg = new (std::nothrow) MainDialog();
if (pDlg == NULL)
{
MessageBox(NULL, TEXT("Out of memory."), NULL, MB_ICONSTOP);
}
else
{
// create and show window
pDlg->ShowDialog(hInstance);
}
MSG msg = {};
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MODELESS_DLG_ACCL));
/* while (TRUE)
{
if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
{
if (Msg.message == WM_QUIT)
break;
else
{
if (Msg.message == WM_KEYDOWN || Msg.message == WM_LBUTTONDOWN)
{
if (Msg.wParam == VK_END)
Msg.wParam = VK_TAB;
if (!IsDialogMessage(hwnd, &Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}// els
}
}*/
/*iRet = GetMessage(&msg, NULL, 0, 0);
We need to pre translate keyboard events here, so can't use GetMessage
solution is to use PeekMessage, ref: http://stackoverflow.com/questions/2441457/keyboard-input-the-win32-message-loop
*/
__pragma(warning(disable:4127))
while (TRUE)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
PostQuitMessage(0);
break;
}
if (msg.message != WM_INITDIALOG) {
if (msg.message == WM_KEYUP) {
if (pDlg != NULL)
{
pDlg->ProcessMessage(pDlg->m_hDlg, msg.message, msg.wParam, msg.lParam);
}
}
}
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg) || !IsDialogMessage(pDlg->GetHwnd(), &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
// time to destroy the dialog box
delete pDlg;
return msg.wParam;
}