/*This program tests the custom WinMainCRTStartup function*/#defineSTRICT#defineWin32_lean_and_mean#include<windows.h>#include<tchar.h>#include<assert.h>//Pimage_dos_headervoidCentertext (HDC hdc,intXintY,lpctstr Szface,lpctstr Szmessage,intPoint ) {Hfont Hfont=createfont (-point * getdevicecaps (hdc,logpixelsy)/ the, 0, 0, 0, Fw_bold, TRUE, FALSE, FALSE, Ansi_charset, Out_tt_precis, Clip_default_precis, Proof_quality, Variable_pitch, Szface); ASSERT (Hfont); Hgdiobj hold=SelectObject (Hdc,hfont); SetTextAlign (Hdc,ta_center|ta_baseline); SetBkMode (hdc,transparent); SetTextColor (Hdc,rgb (0,0,0xFF)); TextOut (Hdc,x,y,szmessage,_tcslen (szmessage)); SelectObject (Hdc,hold); DeleteObject (hold);}ConstTCHAR szmessage[]=_t ("Hello World");ConstTCHAR szface[]=_t ("Times New Roman");#pragmaComment (linker, "-merge:rdata=.text")//#pragma COMMENT (linker, "-align:512")extern "C" voidWinMainCRTStartup () {HDC hdc=GetDC (NULL); ASSERT (HDC); Centertext (Hdc,getsystemmetrics (sm_cxscreen)/2, GetSystemMetrics (Sm_cyscreen)/2, Szface,szmessage, the); ReleaseDC (NULL,HDC); ExitProcess (0);}
Windows Programming _19_ testing Windows application load functions