1

在 Windows 编程中我应该使用 MessageLoop 吗?

我看到任何程序都有 messageLoop 但在这段代码中,作者不使用 messageloop

代码片段:

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR   lpszCmdLine,     int nCmdShow)
{
INITCOMMONCONTROLSEX icc;
WNDCLASSEX wcx;

g_hInstance = hInstance;

icc.dwSize = sizeof(icc);
icc.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&icc);

wcx.cbSize = sizeof(wcx);
if (!GetClassInfoEx(NULL, MAKEINTRESOURCE(32770), &wcx))
    return 0;

wcx.hInstance = hInstance;
wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDR_ICO_MAIN));
wcx.lpszClassName = _T("DirMonClass");
if (!RegisterClassEx(&wcx))
    return 0;

return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc);
 }
4

1 回答 1

2

DialogBox 支持它自己的消息循环。因此,如果您正在编写一个简单的基于对话框的应用程序,则不需要额外的消息循环。

于 2011-01-10T15:11:49.800 回答