Using DefWindowProc
It is a method of using event
message routine as a function of Visual C++.
When using DefWindowProc, the event message routine is called whenever
all events related to the application are generated.
Creating event message routine
In Class
View, right-click on the class to which you want to add the event
message routine.
Then choose Add-Add Function. The Add Member Function Wizard
dialog box is displayed.
Create the function according to the following procedure.
Return type |
LRESULT |
Function name |
DefWindowProc |
Parameter list |
UINT |
Parameter name |
message |
Add |
Click the button |
Parameter list |
WPARAM |
Parameter name |
wParam |
Add |
Click the button |
Parameter list |
LPARAM |
Parameter name |
lParam |
Add |
Click the button |
Access |
protected |
Virtual |
Click the radio button |
Click the
Finish button after confirming that Function signature is
as follows.
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
Specifying window handle
To use
the event, it is necessary to set the window handle of the application
to the driver.
Use the following function for event setting.
Interval Timer |
TimStartTimer |
Specify
the window handle to the hWnd parameter in the event setting function.
The m_hWnd member variable in MFC class contains the window handle In Visual
C++ .NET. Please specify the member variable "as is".
Ret = TimStartTimer(TimerId, 10000, m_hWnd); |