one, windows programming is a kind of event-driven programming procedures,
Office 2010 Professional, mainly depending on the message. When consumers need to have to complete a purpose, you have to call some kind of OS support, and OS consumer requirements to package the message, and place in to the message queue,
Windows 7 Pro, the final application eliminated from the message queue the message and respond.
2, message framework:
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 application are for it to generate a message queue, message queue is often a FIFO buffer, exactly where each and every element is really a message, OS might be produced for each and every message in to the message queue through the buy, the application generally consider away the present message queue the first message, the application that the consumer removed the message soon after the operation and procedures state,
Office 2010 Download, then its response to cope with that message, the message to respond to code.
four, utilizing the VC in addition to an excellent C programming fundamentals needed to grasp two:
one, the message by itself. Signify the diverse consumer facts and application state.
Second, to get a specific message is, let the OS performs a certain function to respond to messages.
5, Window program entry:
int WINAPI WinMain (
HINSTANCE hInstance, / / handle the present case.
HINSTANCE hPrevInstance, / / previous situation manage.
LPSTR lpCmdLine, / / command-line
int nCmdShow pointer ; / / (window) exhibits the state
);
Description: WinMain perform is often a Windows system entry stage function known as through the OS once the OS starts the application when, winmain purpose parameters passed from the OS.
6, to produce a total window to go by way of the adhering to 4 steps:
1st, the design of a window class; including: WNDCLASS wndcls;
2nd, sign-up the window class; such as: RegisterClass (& wndcls);
Third,
Windows 7 Serial, produce a window; like: CreateWindow (), CreateWindowEX ();
Fourth, display and update the window. Like: ShowWindow (), UpdateWindow ();
Note: when creating the window have to be depending on the registered window class.
7, Windows provides the window class:
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,
Windows 7 Product Key, window class registration:
ATOM RegisterClass (
CONST WNDCLASS * lpWndClass / / address of framework with class
; / / data