one, windows programming is really a kind of event-driven programming approaches, mainly based on the message. When end users have to have to total a perform,
Office 2007, call the OS wants some assistance, and OS user wants to deal the message,
Windows 7 Serial, and put into the message queue, the final software eliminated from your message queue the message and reply. 2, message construction: typedef struct tagMSG / / msg HWND hwnd; / / Receive the message window handle. And which window is associated. UINT message; / / message ID. What is the message itself. WPARAM wParam; / / messages for additional information. Depending on the message itself. LPARAM lParam; DWORD time; / / message delivery time. POINT pt; / / message delivery, the location of the cursor on the screen. MSG;
3, message queues: OS each software are for it to produce a message queue, message queue is a FIFO buffer, exactly where each component is a message,
Office 2010 Professional Plus, OS will likely be produced for every message into the message queue by the buy, the software normally get away the current message queue the first message, the application the person eliminated the message soon after the operation and techniques state, then its response to deal with that message, the message to respond to code.
4, utilizing the VC in addition to an excellent C programming fundamentals required to grasp two: 1, the message itself. Symbolize the different user information and application state. Second, for a particular message is, let the OS performs a specific function to reply to messages.
5,
Office 2010 Key, Window plan entry: int WINAPI WinMain ( HINSTANCE hInstance, / / manage the existing case. HINSTANCE hPrevInstance, / / previous case handle. LPSTR lpCmdLine, / / command-line int nCmdShow pointer ; / / (window) displays the state ); Description: WinMain purpose can be a Windows program entry point operate called by the OS when the OS begins the application when, winmain operate parameters handed by the OS.
six, to make a complete window to go by means of the subsequent four actions: Very first, the design of the window class; like: WNDCLASS wndcls; Second, register the window course; including: RegisterClass (& wndcls); Third, make a window; for example: CreateWindow (), CreateWindowEX (); Fourth, display and update the window. Which include: ShowWindow (),
Microsoft Office Professional Plus 2010, UpdateWindow ();
Note: when creating the window must be according to the registered window course.
7, Windows provides the window course: typedef struct _WNDCLASS UINT style; / / window type WNDPROC lpfnWndProc; / / window procedure function pointer (callback function) int cbCl######tra; / / window class additional bytes for the shared type of window. Usually 0. int cbWndExtra; / / window additional bytes. Usually set to 0. HANDLE hInstance; / / the current application instance handle. HICON hIcon; / / icon handle LoadIcon (); HCURSOR hCursor; / / Cursor handle LoadCursor (); HBRUSH hbrBackground; / / brush handle (HBRUSH) GetStockObject (); LPCTSTR lpszMenuName; ; / / menu name LPCTSTR lpszClassName; / / class name WNDCLASS;
8, window class registration: ATOM RegisterClass ( CONST WNDCLASS * lpWndClass / / address of structure with class ; / / data