The WndProc retrieves WM_DESTROY message just after WM_CREATE message.LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;int WINAPI _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PTSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("win32app") ;
HWND hwnd ;
MSG msg ;
WNDCLASSEX wndclass ; wndclass.cbSize = sizeof(WNDCLASSEX) ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (hInstance, szAppName) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
wndclass.hIconSm = LoadIcon (hInstance, szAppName) ; if (!RegisterClassEx (&wndclass))
return 0 ; hwnd = CreateDialog (hInstance, szAppName, 0, NULL) ;
ShowWindow (hwnd, iCmdShow) ; while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
PTSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("win32app") ;
HWND hwnd ;
MSG msg ;
WNDCLASSEX wndclass ; wndclass.cbSize = sizeof(WNDCLASSEX) ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (hInstance, szAppName) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
wndclass.hIconSm = LoadIcon (hInstance, szAppName) ; if (!RegisterClassEx (&wndclass))
return 0 ; hwnd = CreateDialog (hInstance, szAppName, 0, NULL) ;
ShowWindow (hwnd, iCmdShow) ; while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
好像有解决方法
CRT静不静态都不能运行
这是Win32 SDK项目和MFC一点关系都没有
我没有说CRT和MFC有必然关系
且CRT静不静态和我的问题无关
不会有人脑残到因动态链接缺CRT DLL无法运行而来这里问问题的
The WndProc retrieves WM_DESTROY message just after WM_CREATE message.
都说了和CRT无关
就是装不Redistrubution都不能运行
不能运行的情况我已经写得很清楚了!!!!!!!!!!!!!!!!!!!!!!!
我一直很奇怪, CRT貌似没有静态的吧?
根本无法静态链接上,除非提供的就是静态的.lib