-
EnableWindow
鎖定
- 中文名
- EnableWindow
- 外文名
- EnableWindow
- 聲明位置
- WinUser.h
- 返回值類型
- int
- 調用方式
- __stdcall
- 參數類型
- (HWND__*,int)
EnableWindow函數原型
BOOL EnableWindow(HWND hWnd,BOOL bEnable);
WINUSERAPI BOOL WINAPI EnableWindow( _In_HWNDhWnd, _In_BOOLbEnable);
EnableWindow參數
bEnable:定義窗口是被允許,還是被禁止。若該參數為TRUE,則窗口被允許。若該參數為FALSE,則窗口被禁止。
EnableWindow返回值
在 EnableWindow 成員函數調用之前,指示狀態。 如果窗口此前已禁用,則返回值是非零。 返回值是0,則窗口先前啓用或錯誤。若想獲得更多的錯誤信息,可調用GetLastError函數。
EnableWindow其他信息
若窗口的允許狀態將發生變化,WM_ENABLE消息將在Enblewindow函數返回前發送出去,若窗口已被禁止,它所有的子窗口也被禁止,儘管並未向子窗口發送WM_ENABLE消息。
窗口被激活前必須處於允許狀態。比如,一個應用程序將顯示一個無模式對話框並且已使該對話框的主窗口處於禁止狀態,則在撤消該對話框之前須使其主窗口處於允許狀態。否則,其他窗口將接受並被激活。若子窗口被禁止,則系統決定由哪個窗口接受鼠標消息時將忽略該窗口
缺省情況下,窗口被創建時被置為允許。若創建一個初始化為禁止狀態的窗口,應用程序需要在CeateWindow或CeateWindowEX函數中定義WS_DISABLED樣式。窗口創建後,應用程序可用EnbleWindow來允許禁止窗口。
速查:Windows NT:3.1及以上版本;Windows:95及以上版本;Windows CE:1.0及以上版本;頭文件:Winuser.h;庫文件:user32.lib。
EnableWindow示例
//CMyFileDialog is a CFileDialog-derived class
//OnInitDialog is the handler for WM_INITDIALOG
BOOL CMyFileDialog::OnInitDialog()
{
CFileDialog::OnInitDialog();
CWnd* pWndParent = GetParent();
//make sure you add #include <dlgs.h> for IDs 'edt1' & 'stc3'
//disables the 'file name' edit and static control
//of the standard file open dialog
//get handle of 'file name' combobox control & disable it
CWnd* pWnd = pWndParent->GetDlgItem(cmb13);
pWnd->EnableWindow(FALSE);
//get handle of 'file name' static control & disable it
pWnd = pWndParent->GetDlgItem(stc3);
pWnd->EnableWindow(FALSE);
return TRUE;
}
- 詞條統計
-
- 瀏覽次數:次
- 編輯次數:26次歷史版本
- 最近更新: 阿妧云