DefWindowProc: DefWindowProc() does the default processing of messages defined in win32 sub-system. Application calls this function to those messages which does not have any processing inside the application. This ensures that application is processing every single message. Application calls the DefWindowProc() with the same parameters received by the window procedure. Win32 subsystem performs default action for the message when this is called.
- hWnd - Handle to the window procedure that received the message.
- Msg - Specifies the message.
- wParam - Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.
- lParam - Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.
The return value is the result of the message processing and depends on the message.
Windows message processing
Windows GUI subsystem is a server for all application runnding on the frontend desktop. Every application running acts as a client and process an infinite loop of message processing from windows GUI subsystem. It this Window proc is a single point callback. Application process events like keyboard / mouse events can handle individial functions. However each message should be processed and Window proc should return a value. So the remaining messages those are not handled should go to DefWindowProc(). DefWindowProc() is a call back to Win32 GUI server to handle default action for this message.
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 ...
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Draw on printer Free alt softwares