这个哪里错了,出来的是个messagebox窗口
//Win32App.cpp:Definestheentrypointfortheapplication.//#include"stdafx.h"LRESULTCALLB...
// Win32App.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
LRESULT CALLBACK MainWndProc(HWND hWnd,UINT nMessage,WPARAM wParam,LPARAM lParam)
{
switch(nMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return DefWindowProc(hWnd,nMessage,wParam,lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char szAppName[]="Win32 Application";
char szClassName[]="MainWnd";
WNDCLASSEX wcex;
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.cbWndExtra=0;
wcex.cbClsExtra=0;
wcex.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wcex.hIcon=NULL;
wcex.hIconSm=NULL;
wcex.lpfnWndProc=MainWndProc;
wcex.lpszClassName=szClassName;
wcex.lpszMenuName=NULL;
wcex.hInstance=hInstance;
wcex.style=CS_HREDRAW|CS_VREDRAW;
if(!RegisterClassEx(&wcex))
{
MessageBox(NULL,"调用RegisterClassEx函数失败.",szAppName,MB_OK);
return -1;
}
HWND hMainWnd = CreateWindowEx(WS_EX_TOPMOST,
szClassName,
szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hMainWnd,SW_SHOW);
UpdateWindow(hMainWnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} 展开
//
#include "stdafx.h"
LRESULT CALLBACK MainWndProc(HWND hWnd,UINT nMessage,WPARAM wParam,LPARAM lParam)
{
switch(nMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return DefWindowProc(hWnd,nMessage,wParam,lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char szAppName[]="Win32 Application";
char szClassName[]="MainWnd";
WNDCLASSEX wcex;
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.cbWndExtra=0;
wcex.cbClsExtra=0;
wcex.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wcex.hIcon=NULL;
wcex.hIconSm=NULL;
wcex.lpfnWndProc=MainWndProc;
wcex.lpszClassName=szClassName;
wcex.lpszMenuName=NULL;
wcex.hInstance=hInstance;
wcex.style=CS_HREDRAW|CS_VREDRAW;
if(!RegisterClassEx(&wcex))
{
MessageBox(NULL,"调用RegisterClassEx函数失败.",szAppName,MB_OK);
return -1;
}
HWND hMainWnd = CreateWindowEx(WS_EX_TOPMOST,
szClassName,
szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hMainWnd,SW_SHOW);
UpdateWindow(hMainWnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询