C++建立窗口为什么窗口无法显示但是进程里却有

来源:百度知道 编辑:UC知道 时间:2024/06/01 14:38:44
#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wndNewWin;
wndNewWin.cbClsExtra=0;
wndNewWin.cbWndExtra=0;
wndNewWin.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndNewWin.hCursor=LoadCursor(NULL,IDC_CROSS);
wndNewWin.hIcon=LoadIcon(NULL,IDI_ERROR);
wndNewWin.hInstance=hInstance;
wndNewWin.lpfnWndProc=WinSunProc;
wndNewWin.lpszClassName="NewWin";
wndNewWin.lpszMenuName=NULL;
wndNewWin.style=CS_HRED

你的窗口回调函数WinSunProc全部在做你的事情啊,没有做任何windows的默认步骤
你应该对你需要处理的消息进行处理,其他时候用
return ::DefWindowProc (hwnd, uMsg, wParam, lParam) ;