MFC 用向導添加WM_CLOSE訊息,會生成OnClose函式,如何在這個函式中獲取WM_CLOSE的WPARAM和LPARAM引數
uj5u.com熱心網友回復:
WM_CLOSE不帶引數啊uj5u.com熱心網友回復:
我要傳一些訊息
uj5u.com熱心網友回復:
用全域變數就可以傳了啊uj5u.com熱心網友回復:
你要想獲取WM_CLOSE訊息的WPARAM LPARAM引數,你可以在WindowProc函式中過濾WM_CLOSE訊息uj5u.com熱心網友回復:
全域變數不好管理
uj5u.com熱心網友回復:
只有這個辦法了
uj5u.com熱心網友回復:
已經到訊息回掉函式了,而這個函式OnClose默認就沒有形參串列的,所以你攔截不到附加引數,可行方案時重寫虛函式:CWnd::PreTranslateMessage
This method is used by class CWinApp to translate window messages before they are dispatched to the Windows CE TranslateMessage and DispatchMessage functions.
virtual BOOL PreTranslateMessage(
MSG* pMsg );
uj5u.com熱心網友回復:
樓上有答案了,PreTranslateMessage截取WM_CLOSE,然后做你想做的,不必局限于onclose,onclose只是WM_CLOSE訊息默認調取的函式罷了uj5u.com熱心網友回復:
WM_CLOSE的wParam、lParam兩個引數都沒有使用,可以采取樓上幾位的方式進行攔截。#define WM_CLOSE 0x0010
Parameters
wParam
This parameter is not used.
lParam
This parameter is not used.
uj5u.com熱心網友回復:
向7樓致敬!
uj5u.com熱心網友回復:
謝謝大家的幫助轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/106577.html
標籤:界面
上一篇:專案人力資源管理
下一篇:代碼倉庫創建規范
