Windows Programming _ 19 _ test Windows application Loading Function and programming _ 19

Source: Internet
Author: User

Windows Programming _ 19 _ test Windows application Loading Function and programming _ 19

/* This program tests the custom WinMainCRTStartup function */# define STRICT # define WIN32_LEAN_AND_MEAN # include <windows. h> # include <tchar. h> # include <assert. h> // PIMAGE_DOS_HEADER void CenterText (HDC hDC, int x, int y, LPCTSTR szFace, LPCTSTR szMessage, int point) {HFONT hFont = CreateFont (-point * GetDeviceCaps (hDC, LOGPIXELSY)/72, 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 );} const TCHAR szMessage [] = _ T ("Hello world"); const TCHAR szFace [] = _ T ("Times New Roman"); # pragma comment (linker, "-merge: rdata =. text ") // # pragma comment (linker,"-align: 512 ") extern" C "void WinMainCRTStartup () {HDC hDC = GetDC (NULL); assert (hDC ); centerText (hDC, GetSystemMetrics (SM_CXSCREEN)/2, GetSystemMetrics (SM_CYSCREEN)/2, szFace, szMessage, 72); ReleaseDC (NULL, hDC); ExitProcess (0 );}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.