GetCurrentMessage

GetCurrentMessage,計算機術語。用於獲取這個視窗當前處理的訊息的指針。

基本介紹

  • 外文名:GetCurrentMessage
  • 類型:計算機術語
術語簡介,示例,

術語簡介

類: CWnd
頭檔案:
afxwin.h
語法:
static const MSG* PASCAL GetCurrentMessage;
返回值:
返回一個指向MSG結構的指針,該結構中包含了視窗當前處理的訊息。
說明:
只應該在OnMessage訊息處理函式內部調用這個函式。

示例

/**********************************************************
演示函式原型: const MSG* pMsg=GetCurrentMessage;
程式功能說明: 截獲當前處理的訊息並傳送到子窗體。
*********************************************************/
CWinApp * pApp=AfxGetApp;
CWindow myWindow; //CWindow對象myWindow
myWindow.Attach(hWnd); //hWnd表示視窗句柄
//傳送信息到子視窗
if(!(myWindow.GetStyle()&WS_CHILD)) //WS_CHILD表示生成的視窗是母視窗的子視窗
{
//獲得當前處理的訊息
const MSG* pMsg=GetCurrentMessage;
//傳送當前信息到子視窗
SendMessageToDescendants(pMsg-message,pMsg-wparam,pMsg-lparam,TRUE,TRUE);
}

相關詞條

熱門詞條

聯絡我們