最近在看《Windows程序设计》,我发现我发现自己用VC编译链接书中的例子时,都会弹出“最近在看《Windows程序设计》,我发现我发现自己用VC编译链接书中的例子时,都会弹出“ThisprogramrequireWindowsNT”,请问是不是我的电脑系统不对,请问我该怎么办啊?难道要换系统么。
下面是其中的一个例子
#includewindows.h
LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);
intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRlpCmdLine,intnCmdShow)
{
staticTCHARszAppName[]=TEXT(\"HelloWin\");
HWNDhwnd;
MSGmsg;
WNDCLASSwndclass;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=szAppName;
if(!RegisterClass(
return0;
}
hwnd=CreateWindow(szAppName,TEXT(\"TheHelloProgram\"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(
DispatchMessage(
}
returnmsg.wParam;
}
LRESULTCALLBACKWndProc(HWNDhwnd,UINTmessage,WPARAMwParam,LPARAMlParam)
{
HDChdc;
PAINTSTRUCTps;
RECTrect;
switch(message)
{
caseWM_CREATE:
PlaySound(TEXT(\"hellowin.wav\"),NULL,SND_FILENAME|SND_ASYNC);
return0;
caseWM_PAINT:
hdc=BeginPaint(hwnd,
GetClientRect(hwnd,
DrawText(hdc,TEXT(\"HelloWindows98!\"),-1,
EndPaint(hwnd,
return0;
caseWM_DESTROY:
PostQuitMessage(0);
return0;
}
returnDefWindowProc(hwnd,message,wParam,lParam);
} |