Objective:
In Visual C + + programming, sometimes need to use as large as possible areas as a display area, then the full screen display of the program is a good choice, the so-called full screen display, is the program interface without a menu, toolbar, and other additional items, the entire display screen as a display window to display data or images , many Windows applications offer Full-screen display features such as Word, Excel, and IE. This example shows how to implement a full screen display of a program by responding to a mouse click to draw a digital curve across the screen.
One, the realization method
The implementation of the full screen of the program is actually very easy, it is the realization of the idea is: first to customize a window class, overload the Window class OnPaint () or OnDraw () function, to achieve a specific window display function, and then invoke the API function getdevicecaps (int nindex) function to get the size of the current display screen, such as nindex logpixelsx value to get the width of the screen (in pixels), take logpixelsy value to get the height of the screen. With the size of the screen is not enough, you must also call an API function MoveWindow () to locate the current window to the entire screen. The reader should be aware that in order to realize the interaction between the window and the user, to load a cursor in the window, and to restore the full screen to the normal state, it is necessary to process the WM_KEYDOWN message in the window class, in which the user presses the ESC (exit) key in the message handler function. The program reverts to its normal display state. The following code implements all of the above functions and is able to respond to mouse actions, digital curves on the screen. The programming steps are as follows:
1, the definition of a window class Cgribblewnd, it contains two plastic variable m_pixelsx, m_pixelsy, respectively, to store the size of the window;
2, the use of ClassWizard overloaded window class Onpain () function, to achieve specific display functions;
3, the use of ClassWizard for the window class to add Wm_create, WM_ERASEBKGND, WM_KEYDOWN, wm_lbuttondown and other message processing functions to achieve a full screen window and respond to user operations;