为什么我的窗口没有显示?进程在的!

sword0511 2012-06-20 10:47:28
#include<Windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE PreInstance,
LPSTR lpCmdLine,
int nCmdShow){
HWND hWnd;
MSG msg;
char lpszClassName[] ="we";
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = lpszClassName;
hWnd = CreateWindow(lpszClassName,
"windows",
WS_OVERLAPPEDWINDOW,
120,50,800,600,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
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_LBUTTONDOWN:
MessageBeep(0);break;
case WM_DESTROY:
PostQuitMessage(0);break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
return 0;
}
...全文
40 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
2012-06-20
  • 打赏
  • 举报
回复
出了PRoc有点简单外,看不出其他地方有问题啊
sword0511 2012-06-20
  • 打赏
  • 举报
回复
我sb了,忘记注册了

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧