Home > Software engineering >  MFC wizard to add WM_CLOSE message, generates OnClose function, how to obtain the WM_CLOSE WPARAM an
MFC wizard to add WM_CLOSE message, generates OnClose function, how to obtain the WM_CLOSE WPARAM an

Time:10-02

MFC wizard to add WM_CLOSE message, generates OnClose function, how to obtain the WM_CLOSE WPARAM in the function and the LPARAM parameter

CodePudding user response:

WM_CLOSE with no arguments

CodePudding user response:

reference 1st floor shiyanzi response:
WM_CLOSE with no arguments.

I want to report some news

CodePudding user response:

With global variables can pass it

CodePudding user response:

If you want to get the WPARAM WM_CLOSE message LPARAM parameter, you can filter the WM_CLOSE message in the WindowProc function

CodePudding user response:

reference shiyanzi reply: 3/f
use global variables can pass ah

A global variable is bad management

CodePudding user response:

The
reference 4 floor VisualEleven reply:
if you want to get the WPARAM WM_CLOSE message LPARAM parameters, you can filter in the WindowProc function WM_CLOSE message

Only this way

CodePudding user response:

Already back to news function and the function OnClose default there is no parameter list, so you can't intercept additional parameters, feasible scheme rewriting virtual function: when

 CWnd: : PreTranslateMessage 
This method is 2 by class CWinApp to translate window messages before they are dispatched to the Windows CE TranslateMessage and DispatchMessage functions provides.

Virtual BOOL PreTranslateMessage (
MSG * pMsg);

CodePudding user response:

Upstairs is the answer, PreTranslateMessage intercept WM_CLOSE, then do what you want, don't have to be limited to the onclose, onclose just WM_CLOSE message default function to be obtained

CodePudding user response:

WM_CLOSE wParam, lParam two parameters are not used, can take several ways to intercept upstairs,

# define WM_CLOSE 0 x0010

The Parameters
WParam
This parameter is not 2.
LParam
This parameter is not 2.

CodePudding user response:

Salute to 7th floor!

CodePudding user response:

Thank you for your help
  • Related