当前位置:首页 科普知识 GetDesktopWindow

GetDesktopWindow

发布时间:2023-09-14 00:53:27

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());

GetDesktopWindow

// 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)

GetDesktopWindow

{

// 记录窗口当前是否处于全屏状态

return m_bFullScreen;

}

温馨提示:
本文【GetDesktopWindow】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6