MFC编程 窗口显示问题 10
程序代码:#include<windows.h>#include<stdio.h>LRESULTCALLBACKWindowProc(HWNDhwnd,UINTuMsg,...
程序代码:
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstince,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_HELP);
wndclass.hIcon=LoadIcon(NULL,IDI_ERROR);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WindowProc;
wndclass.lpszClassName="kaka";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE;
RegisterClass(&wndclass);
HWND hwnd;
hwnd=CreateWindow("kaka","first_time",WS_MAXIMIZE,0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
MSG uMsg;
while(GetMessage(&uMsg,hwnd,0,0))
{
TranslateMessage(&uMsg);
DispatchMessage(&uMsg);
}
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_CHAR:
MessageBox(hwnd,"kaka",NULL,MB_OK);
};
return 0;
}
出现的状况:在进程中可以找到这个程序的进程 桌面上没有这个程序的窗口
请问是不是那个showwindow函数出了什么问题? 或者是createwindow的窗口样式的地方出了问题... 展开
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstince,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_HELP);
wndclass.hIcon=LoadIcon(NULL,IDI_ERROR);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WindowProc;
wndclass.lpszClassName="kaka";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE;
RegisterClass(&wndclass);
HWND hwnd;
hwnd=CreateWindow("kaka","first_time",WS_MAXIMIZE,0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
MSG uMsg;
while(GetMessage(&uMsg,hwnd,0,0))
{
TranslateMessage(&uMsg);
DispatchMessage(&uMsg);
}
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_CHAR:
MessageBox(hwnd,"kaka",NULL,MB_OK);
};
return 0;
}
出现的状况:在进程中可以找到这个程序的进程 桌面上没有这个程序的窗口
请问是不是那个showwindow函数出了什么问题? 或者是createwindow的窗口样式的地方出了问题... 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询