所有栏目

GetDesktopWindow

作者:爱百科

GetDesktopWindow,该函数返回桌面窗口的句柄。桌面窗口覆盖整个屏幕。桌面窗口是一个要在其上绘制所有的图标和其他窗口的区域。

GetDesktopWindow介绍

GetDesktopWindow,该函数返回桌面窗口的句柄。桌面窗口覆盖整个屏幕。桌面窗口是一个要在其上绘制所有的图标和其他窗口的区域。

GetDesktopWindow函数功能

函数原型:HWND GetDesktopWindow(VOID)

参数:无。

返回值:函数返回桌面窗口的句柄。

速查:Windows NT:3.1以上版本;Windows:95以上版本:;头文件:Winuser.h;库文件:user32.lib。

GetDesktopWindow声明

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#

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;

}

热点导航
教育资讯 知道问答 公考资讯 司法考试 建筑知识 工作范文 大学排名 报考专业 学习方法 句子美文 秒知回答 作业解答 精选答案 知途问学