当前位置首页 > 百科> 正文

GetDesktopWindow

2019-12-21 02:48:18 百科

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;
}
声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:baisebaisebaise@yeah.net