写个最简单的C++程序

来源:百度知道 编辑:UC知道 时间:2024/05/14 05:48:30
帮我写个最简单的C++程序
最起码要有显示窗体。。

要新建 WIN32 Application 才可以

#include <windows.h>

HINSTANCE hInst;
HWND hWnd;

ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;

MyRegisterClass(hInstance);

if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}

while( msg.message!=WM_QUIT )
{
if( PeekMessage( &msg, NULL, 0,0 ,PM_REMOVE) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{

}
}

return msg.wParam;
}

ATOM MyRegisterClass(HINSTANCE hInstance)
{
WN