The WM_MOUSEMOVE message is posted to a window when the cursor moves. Mouse co-ordinates are passed through WM_MOUSEMOVE event using LPARAM. Lower word of LPARAM contains x position. Upper word contains the y position.
WM_MOUSEMOVE fwKeys = wParam; // key flags xPos = LOWORD(lParam); // horizontal position of cursor yPos = HIWORD(lParam); // vertical position of cursorParameters
- MK_CONTROL - Set if the ctrl key is down.
- MK_LBUTTON - Set if the left mouse button is down.
- MK_MBUTTON - Set if the middle mouse button is down.
- MK_RBUTTON - Set if the right mouse button is down.
- MK_SHIFT - Set if the shift key is down.
yPos : Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
About our authors: Team EQA
MFC hides WinMain in its framework and includes source file on WinMain(). This explains how framework calls global CWinApp::Initinstance() from entry WinMain.
This is constructed during global C++ objects are constructed and is already available when Windows calls the WinMain function, which is supplied by the ...
Define a custom Window class structure, Register the class name, CreateWindow, Show windows and write message get and dispatch loop statements. Define the Window CallBack procedure and write the handlers.
DispatchMessage() is a API which indirectly triggers the Window CallBack procedure. Message structure members from this function are passed to the CallBack procedure. CallBack procedure should implement event handlers depending on the need of the application.
LPARAM and WPARAM are the two parameters in Window CallBack procedure. They signifies parameters of various events. They are used in handing individual events.
We need to write WinMain and need to follow all these in a Win32 application. However we need not to write much if we are writing an application with MFC ...
Learn on Youtube