GetDesktopWindow

GetDesktopWindow,該函式返回桌面視窗的句柄。桌面視窗覆蓋整個螢幕。桌面視窗是一個要在其上繪製所有的圖示和其他視窗的區域。

基本介紹

  • 中文名:GetDesktopWindow
  • 函式功能:該函式返回桌面視窗的句柄
  • 函式原型:HWND GetDesktopWindow
  • 返回值:函式返回桌面視窗的句柄。
函式功能,聲明,

函式功能

函式原型:HWND GetDesktopWindow(VOID
參數:無。
返回值:函式返回桌面視窗的句柄。
速查:Windows NT:3.1以上版本;Windows:95以上版本:;頭檔案:Winuser.h;庫檔案:user32.lib。

聲明

vb
Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
vb_net
Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
S

【說明】
獲得代表整個螢幕的一個視窗(桌面視窗)句柄
【返回值】
Long,桌面視窗的句柄
C#
[DllImport("user32", EntryPoint="GetDesktopWindow")]
public static extern IntPtrGetDesktopWindow ();
返回值是IntPtr 是桌面句柄
MFC實例 - 全螢幕顯示
void CFullScreenDlg::FullScreenView(void)
{
RECT rectDesktop;
WINDOWPLACEMENT wpNew;
if (!IsFullScreen())
{
// We'll need these to restore the original state.
GetWindowPlacement (&m_wpPrev);
//Adjust RECT to new size of window
::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop );
::AdjustWindowRectEx(&rectDesktop, GetStyle(), FALSE, GetExStyle());
// Remember this for OnGetMinMaxInfo()
m_rcFullScreenRect = rectDesktop;
wpNew = m_wpPrev;
wpNew.showCmd = SW_SHOWNORMAL;
wpNew.rcNormalPosition = rectDesktop;
m_bFullScreen=true;
}
else
{
// 退出全螢幕幕時恢復到原來的視窗狀態
m_bFullScreen=false;null
wpNew = m_wpPrev;
}
SetWindowPlacement ( &wpNew );
}
void CFullScreenDlg::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
// TODO: Add your message handler code here and/or call default
if (IsFullScreen())
{
lpMMI->ptMaxSize.y = m_rcFullScreenRect.Height();
lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y;
lpMMI->ptMaxSize.x = m_rcFullScreenRect.Width();
lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x;
}
CDialog::OnGetMinMaxInfo(lpMMI);
}
bool CFullScreenDlg::IsFullScreen(void)
{
// 記錄視窗當前是否處於全螢幕狀態
return m_bFullScreen;
}

  

  

相關詞條

熱門詞條

聯絡我們