Windows 這個多作業系統除了協調應用程式的執行、配置設定記憶體、管理資源…之外, 它同時也是一個很大的服務中心,調用這個服務中心的各種服務(每一種服務就是一個函數),可以幫應用程式達到開啟視窗、描繪圖形、使用周邊裝置等目的,由于這些函數服務的對象是應用程式(Application), 是以便稱之為 Application Programming Interface,簡稱 API 函數。WIN32 API也就是Microsoft Windows 32位平台的應用程式程式設計接口。
函數功能:該函數傳回桌面視窗的句柄。桌面視窗覆寫整個螢幕。桌面視窗是一個要在其上繪制所有的圖示和其他視窗的區域。
函數原型: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
c#
[DllImport(“user32.dll”, EntryPoint = “GetDesktopWindow”, CharSet = CharSet.Auto, SetLastError = true)]
static extern IntPtr GetDesktopWindow();
【說明】
獲得代表整個螢幕的一個視窗(桌面視窗)句柄
【傳回值】
Long,桌面視窗的句柄
檔案->建立->項目…