GetDesktopWindow和GetWindow区别

本文介绍了Windows API中用于获取桌面窗口句柄的GetDesktopWindow函数及获取与指定窗口有特定关系的窗口句柄的GetWindow函数。这些函数在Windows编程中常用于窗口管理和操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

GetWindow

The GetWindow function retrieves a handle to a window that has the specified relationship (Z order or owner) to the specified window.

HWND GetWindow(
  HWND hWnd,  // handle to original window
  UINT uCmd   // relationship flag
);

GetDesktopWindow

The GetDesktopWindow function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.

HWND GetDesktopWindow(VOID)
 
注释:GetDesktopWindow该函数返回桌面窗口的句柄;GetWindow该函数返回与指定窗口有特定关系(如Z序或所有者)的窗口句柄。
该特定的关系是通过UINT uCmd 值体现的.
下面来解释一下什么叫桌面窗口的句柄:桌面也是个窗口,成为桌面窗口,它是由windows操作系统创建的和管理的.