仅供参考:#pragmacomment(lib,"user32")
#pragmacomment(lib,"gdi32")
#include
LRESULTCALLBACKWndProc(HWNDhWnd,UINTmessage,WPARAMwParam,LPARAMlParam){
PAINTSTRUCTps;
HDChdc;
HFONThfont,ohfont;
RECTr;
COLORREFoc;
switch(message){
caseWM_CLOSE://按Alt+F4退出
PostQuitMessage(0);
break;
caseWM_PAINT:
BeginPaint(hWnd,&ps);
hdc=ps.hdc;//thedevicecontexttodrawin
GetClientRect(hWnd,&r);//Obtainthewindow'sclientrectangle
hfont=CreateFont(200,0,0,0,0,0,0,0,0,0,0,0,0,"宋体");
ohfont=(HFONT)SelectObject(hdc,hfont);
oc=SetTextColor(hdc,0x00C080FF);
SetBkMode(hdc,TRANSPARENT);
TextOut(hdc,r.left+r.right/2-600,r.top+r.bottom/2-100,"最短画图程序",12);
SelectObject(hdc,ohfont);
SetTextColor(hdc,oc);
DeleteObject(hfont);
EndPaint(hWnd,&ps);
break;
default:
returnDefWindowProc(hWnd,message,wParam,lParam);
}
return0;
}
intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLine,intnCmdShow){
MSGmsg={0};
WNDCLASSwc={0};
HBRUSHhbrh;
hbrh=CreateSolidBrush(0x00000000);
wc.lpfnWndProc=WndProc;
wc.hInstance=hInstance;
wc.hbrBackground=hbrh;
wc.lpszClassName="minwindowsapp";
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
if(FAILED(RegisterClass(&wc)))return1;
if(FAILED(CreateWindow(wc.lpszClassName,
"MinimalWindowsApplication",
WS_POPUP|WS_VISIBLE,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
0,
0,
hInstance,
NULL)))
return2;
while(GetMessage(&msg,NULL,0,0)>0){
DispatchMessage(&msg);
}
DeleteObject(hbrh);
return0;
}
|