User32.dll詳細介紹

RegisterServiceProcess(ProcessID:Long,Type:Long) 
該函數存在於Kernal32.dll中. 
Process指向進程的ID,Type表示是否向系統註冊該進程,是1,否0.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetClientRect
函數功能:該函數獲取窗口客戶區的座標。客戶區座標指定客戶區的左上角和右下角。因爲客戶區座標是相對子窗口客戶區的左上角而言的,所以左上角座標爲(0,0)
函數原型:BOOL GetClientRect(HWND hWnd,LPRECT lpRect);
參數:
GetLastError 函數。
備註:Windows CE:命令條包含在客戶區中。
速查:Windows NT: 3.1以上版本:Windows:95以上版本: Windows CE:1.0以上版本:頭文件:winuser.h;庫文件:user32.lib
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetDesktopWindow
函數功能:該函數返回桌面窗口的句柄。桌面窗口覆蓋整個屏幕。桌面窗口是一個要在其上繪製全部的圖標和其餘窗口的區域。
函數原型:HWND GetDesktopWindow(VOID)
參數:無。
返回值:函數返回桌面窗口的句柄。
速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:不支持;頭文件:Winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetForegroundwindow
函數功能:該函數返回前臺窗口(用戶當前工做的窗口)。系統分配給產生前臺窗口的線程一個稍高一點的優先級。
函數原型:HWND GetForegroundwindow(VOID)
參數:無。
返回值:函數返回前臺窗回的句柄。
速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:1.0以上版本:頭文件:Winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetLastActivePopup 
函數功能:該函數肯定指定窗口中的哪個彈出式窗口是最近活動的窗口。
函數原型:HWND GetLastActivePopup(HWND hWnd);
參數:
hWnd:全部者窗口句柄。
返回值:返回值標識了最近活動的彈出式窗口的句柄。若是知足下列任一條件,則返回值與參數hWnd
相同:由hWnd指定的窗口是最近活動的:由hWnd指定的窗口不擁有任何彈出式窗口;由hWnd指定的窗口不是頂層窗口或它屬於其餘窗口。
速查:Windows:3.1以上版本;Windows:95以上版本:Windows CE:不支持;頭文件:winuser.h;
庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetNextWindow
函數功能:該函數返回z序中的前一個或後一個窗口的句柄。下一窗口在指定窗口的下面,前一窗口則在上面。若是指定的窗口是頂端窗口,該函數返回下一個(或前一個)頂端窗口的句柄。若是指定的窗口是頂層窗口,函數返回下一個(或前一個)頂層窗口的句柄。若是函數是子窗口,則函數搜索下一個或前一個子窗口的句柄。
函數原型:HWND GetNextWindow(HWND hWnd,UNIT wCmd);
參數:
hWnd:一個窗口的句柄。窗口句柄在wCmd參數的基礎上得到的相對於這個窗口的句柄。
wCmd:指明窗口返回的是前一窗口的句柄仍是後一窗口的句柄。該參數能夠是下列兩個值之一:
GW HWNONEXT:返回在給定窗口的下面窗口的句柄。
GW_HWNDPREV:返回在給定窗口的上面窗口的句柄。
返回值:若是函數成功,返回值是前一窗口(或後一窗口)的句柄。若是先後窗口不存在,則返回值爲NULL。若想得到更多錯誤信息,請調用GetLastError函數。
備註:在設定了GW_HWNDNEXT或GW_GETPREV標誌時,調用該函數與調用GetWindow函數相同。
速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:不支持:頭文件:Winuer.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetParent
函數功能:該函數得到一個指定子窗口的父窗口句柄。
函數原型:HWND GetParent(HWND hWnd);
參數:
hWnd:子窗口句柄,函數要得到該子窗口的父窗口句柄。
返回值:若是函數成功,返回值爲父窗口句柄。若是窗口無父窗口,則函數返回NULL。若想得到更多錯誤信息,請調用GetLastError函數。
備註:WindowsCE:Windows CE1.0版本不支持除了對話框以外的所屬子窗口。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本:頭文件:Winuser.h:庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetTopWindow
函數功能:該函數檢查與特定父窗口相聯的子窗口z序,並返回在z序頂部的子窗口的句柄。
函數原型:HWND GetTopWindow(HWND hWnd);
參數:
hWnd:被查序的父窗口的句柄。若是該參數爲NULL,函數返回Z序頂部的窗口句柄。
返回值;若是函數成功,返回值爲在Z序頂部的子窗口句柄。若是指定的窗口無子窗口,返回值爲NULL。
若想得到更多錯誤信息,請調用GetLastError函數。
速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:不支持;頭文件:Winuser.h:庫文件;user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindow
函數功能:該函數返回與指定窗口有特定關係(如Z序或全部者)的窗口句柄。
函數原型:HWND GetWindow(HWND hWnd,UNIT nCmd);
參數:
hWnd:窗口句柄。要得到的窗口句柄是依據nCmd參數值相對於這個窗口的句柄。
nCmd:說明指定窗口與要得到句柄的窗口之間的關係。該參數值能夠是下列之一:
GW_CHILD:若是指定窗口是父窗口,則得到的是在Z序頂端的子窗口的句柄,不然爲NULL。函數僅檢查指定父窗口的子窗口,不檢查繼承窗口。
GW_ENABLEDPOUP:(WindowsNT 5.0)返回的句柄標識了屬於指定窗口的處於使能狀態彈出式窗口(檢索使用第一個由GW_HWNDNEXT 查找到的知足前述條件的窗口);若是無使能窗口,則得到的句柄與指定窗口相同。
GW_HWNDFIRST:返回的句柄標識了在Z序最高端的相同類型的窗口。若是指定窗口是最高端窗口,則該句柄標識了在Z序最高端的最高端窗口;若是指定窗口是頂層窗口,則該句柄標識了在z序最高端的頂層窗口:若是指定窗口是子窗口,則句柄標識了在Z序最高端的同屬窗口。
GW_HWNDLAST:返回的句柄標識了在z序最低端的相同類型的窗口。若是指定窗口是最高端窗口,則該柄標識了在z序最低端的最高端窗口:若是指定窗口是頂層窗口,則該句柄標識了在z序最低端的頂層窗口;若是指定窗口是子窗口,則句柄標識了在Z序最低端的同屬窗口。
GW_HWNDNEXT:返回的句柄標識了在Z序中指定窗口下的相同類型的窗口。若是指定窗口是最高端窗口,則該句柄標識了在指定窗口下的最高端窗口:若是指定窗口是頂層窗口,則該句柄標識了在指定窗口下的頂層窗口;若是指定窗口是子窗口,則句柄標識了在指定窗口下的同屬窗口。
GW HWNDPREV:返回的句柄標識了在Z序中指定窗口上的相同類型的窗口。若是指定窗口是最高端窗口,則該句柄標識了在指定窗口上的最高端窗口;若是指定窗口是頂層窗口,則該句柄標識了在指定窗口上的頂層窗口;若是指定窗口是子窗口,則句柄標識了在指定窗口上的同屬窗口。
GW_OWNER:返回的句柄標識了指定窗口的全部者窗口(若是存在)。
返回值:若是函數成功,返回值爲窗口句柄;若是與指定窗口有特定關係的窗口不存在,則返回值爲NULL。
若想得到更多錯誤信息,請調用GetLastError函數。
備註:在循環體中調用函數EnumChildWindow比調用GetWindow函數可靠。調用GetWindow函數實現該任務的應用程序可能會陷入死循環或退回一個已被銷燬的窗口句柄。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;頭文件:winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindowPlacement
函數功能:該函數返回指定窗口的顯示狀態以及被恢復的、最大化的和最小化的窗口位置。
函數原型:BOOL GetWindowPlacement(HWND hWnd,WINDOWPLACEMENT★lpwndpl);
參數:
hWnd: 窗日句柄。
lpwndpl:指向WINDOWPLACEMENT結構的指針,該結構存貯顯示狀態和位置信息。
在調用GetWindowPlacement函數以前,將WINDOWPLACEMENT結構的長度設爲
sizeof(WIDNOWPLACEMENT)。若是lpwndpl->length設置不正確則函數GetWindowPlacement將失敗。
返回值;若是函數成功,返回值爲非零;若是函數失敗,返回值爲零。若想得到更多錯誤信息,請調用GetlastError函數。
備註:由該函數得到的WINDOWPLACEMENT結構的flag單元總爲0。若是hWnd的窗口被最大化,則showCmd元爲 SHOWMZAXMIZED,若是窗口被最小化,則showCmd元爲SHOWMINIMIZED,除此以外爲SHOWNORMN, WINDOWPLACEMENT長度單元必須置爲sizeOf( WINDOWPLACEMENT),若是參數設置不正確,函數返回FALSE。查看設置窗口位置座標的正確信息,參看WINDOWPLACEMENT。
速查:Windows Nt:3.1以上版本:Windows:95以上版本;Windows CE:不支持;頭文件:Winuser.h;庫文件:User32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindowRect
函數功能:該函數返回指定窗口的邊框矩形的尺寸。該尺寸以相對於屏幕座標左上角的屏幕座標給出。
函數原型:BOOL GetWindowRect(HWND hWnd,LPRECTlpRect);
參數:
hWnd:窗口句柄。
lpRect:指向一個RECT結構的指針,該結構接收窗口的左上角和右下角的屏幕座標。
返回值:若是函數成功,返回值爲非零:若是函數失敗,返回值爲零。若想得到更多錯誤信息,請調用GetLastError函數。
速查:Windows NT:3.1以上版本:Windows:95以上版本;Windows CE:1.0以上版本;頭文件:Winuser.h;庫文件:User32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindowText
函數功能:該函數將指定窗口的標題條文本(若是存在)拷貝到一個緩存區內。若是指定的窗口是一個控制,則拷貝控制的文本。可是,GetWindowTeXt不能接收在其餘應用程序中的控制文本。
函數原型:Int GetWindowText(HWND hWnd,LPTSTR lpString,Int nMaxCount);
參數:
hWnd:帶文本的窗口或控制的句柄。
IpString:指向接收文本的緩衝區的指針。
nMaxCount:指定要保存在緩衝區內的字符的最大個數,其中包含NULL字符。若是文本超過界限,它就被截斷。
返回值:若是函數成功,返回值是拷貝的字符串的字符個數,不包括中斷的空字符;若是窗口無標題欄或文本,或標題欄爲空,或窗口或控制的句柄無效,則返回值爲零。若想得到更多錯誤信息,請調用GetLastError函數。
函數不能返回在其餘應用程序中的編輯控制的文本。
備註:若是目標窗口屬於當前進程,GetWindowText函數給指定的窗口或控制發送WM_GETTEXT消息。若是目標窗口屬於其餘進程,而且有一個窗口標題,則GetWindowTeXt返回窗口的標題文本,若是窗口無標題,則函數返回空字符串。
速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:1.0以上版本;頭文件:Winuser.h;庫文件:user32.lib:Unicode:在Windows NT上實現爲Unicode和ANSI兩種版本。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
IsChild
函數功能:該函數測試一個窗口是不是指定父窗口的子窗口或後代窗口。若是該父窗口是在父窗口的鏈表上則子窗口是指定父窗口的直接後代。父窗口鏈表從原始層疊窗口或彈出窗口一直連到該子窗口。
函數原型:BOOL IsChild(HWND hWndParant,HWND hWnd);
參數:
hWndparant:父窗口句柄。
hWnd:將被測試的窗口句柄。
返回值:若是窗口是指定窗口的子窗口或後代窗口,則退回值爲非零。若是窗口不是指定窗口的子窗口或後代窗口,則退回值爲零。
速查:Windows NT:3.1以上版本:Windows:95以上版本;Windows CE:1.0以上版本;頭文件:winuser.h;庫文件:user32.Iib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindowTextLent
函數功能:該函數返回指定窗口的標題文本(若是存在)的字符長度。若是指定窗口是一個控制,函數將返回控制內文本的長度。可是GetWindowTextLength函數不能返回在其餘應用程序中的控制的文本長度。
函數原型:nit GetWindowTextLent(HWND hWnd);
參數:
hWnd:窗口或控制的句柄。
返回值:若是函數成功,返回值爲文本的字符長度。在必定的條件下,返回值可能比實際的文本長度大。請參看說明。若是窗口無文本,返回值爲零。若想得到更多錯誤信息,請調用GetLastError函數。
備註:若是目標窗口屬於當前進程,GetWindowTextLength函數給指定的窗口或控制發送WM_GETTEXT消息。
在必定的條件下,函數GetWindowTextLength的返回值可能比實際的文本長度大。這是因爲ANSI和Unlcode的混和使用以及系統容許 DBCS字符在文本內存在的緣由,可是函數返回值要至少與文本的實際長度相等,所以能夠利用這一點指導緩存區的分配。在應用程序既使用ANSI函數又使用 Unicode的普通對話框時就會有緩存分配的問題;一樣,當應用程序在一個Unicode的窗口過程當中使用了ANSI的 GetWindowTextLength函數,或在一個ANSI的窗口過程當中使用了Unicode的GetWindowTextLength函數的時候也有緩存分配的問題。查看ANSI和Vnicode函數,參考Wind32函數prototypes。
要得到文本的實際長度,使用WM_GETTEXT, LB_GETTEXT或CB_GETLBTBTEXT消息或GetWindowText函數。
速查:Windows NT:3.1以上版本:Windows:95以上版本:Windows CE:1.0以上版本;頭文件:Winuser.h;庫文件:user32.lib;Unicode:在Windows NT上實現爲山Unicode和ANSI兩種版本。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
GetWindowThreadProcessld
函數功能:該函數返回建立指定窗口線程的標識和建立窗口的進程的標識符,後一項是可選的。
函數原型;DWORD GetWindowThreadProcessld(HWND hwnd,LPDWORD lpdwProcessld);
參數:
hWnd:窗口句柄。
lpdwProcessld:接收進程標識的32位值的地址。若是這個參數不爲NULL,GetWindwThreadProcessld將進程標識拷貝到這個32位值中,不然不拷貝。
返回值:返回值爲建立窗口的線程標識。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;頭文件:winuser.h;庫文件;user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
IsIconic
函數功能:該函數肯定給定窗口是不是最小化(圖標化)的窗口。
函數原型:BOOL IsIconic(HWND hWnd);
參數:
hWnd:被測試窗口的句柄。
返回值:若是窗口已圖標化,返回值爲非零;若是窗口未圖標化,返回值爲零。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:不支持;頭文件:winuser.h;
庫文件:user32.Iib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
isWindow
函數功能:該函數肯定給定的窗口句柄是否識別一個已存在的窗口。
因數原型:BOOL isWindow(HWND hWnd);
參數:
hWnd:被測試窗口的句柄。
返回值:若是窗口句柄標識了一個已存在的窗口,返回值爲非零;若是窗口句柄未標識一個已存在窗口,返回值爲零。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;頭文件:winuserhs;庫文件:User32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
lswindowUnicode
函數功能:該函數肯定指定的窗口是不是一個本地Unicode窗口。
函數原型: BOOL lswindowUnicode(HWND hwndJ;
參數:
hWnd:被測試窗口的句柄。
返回值:若是窗口是一個本地Unicode窗口,返回值爲非零;若是窗口不是一個本地Unicode窗口,返回值爲零,同時說明窗口是一個ANSI窗口。
備註;一個窗口的字符集是由函數RegosterClass決定的。若是窗口類是以ANSI版的RegisterClass   ( RegjsterClassA)註冊的,則窗口字符集是ANSI的;若是窗口類是以Unicode版的Registerclass ( RegisterClassW)註冊的,則窗口字符集是Unicode。
系統爲窗口消息自動做Unicode和ANSI的雙向翻譯。例如,若是一個使用Unicode字符集的窗口測到一個ANSI窗口消息,則系統在調用窗口過程以前先將該消息轉換爲Unicode消息。系統調用lsWindowUnicode函數決定是否翻譯消息。
速查:Windows NT:3.1以上版本;Windows: 95以上版本;Windows CE:不支持;頭文件:Winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
IsWindowVisible
函數功能:該函數得到給定窗口的可視狀態。;
函數原型:BOOL IsWindowVisible(HWND hWnd);
參數;
hWnd:被測試窗口的句柄。
返回值:若是指定的窗口及其父窗口具備WS_VISIBLE風格,返回值爲非零;若是指定的窗口及其父窗口不具備WS_VISIBLE風格,返回值爲零。因爲返回值代表了窗口是否具備Ws_VISIBLE風格,所以,即便該窗口被其餘窗口遮蓋,函數返回值也爲非零。
備註:窗口的可視狀態由WS_VISIBLE位指示。當設置了WS_VISIBLE位,窗口就可顯示,並且只要窗口具備WS_VISIBLE風格,任何畫在窗口的信息都將被顯示。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;頭文件:winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
IsZoomed
函數功能:該函數肯定窗口是不是最大化的窗口。
函數原型:BOOL IsZoomed(HWND hWnd);
參數:
hWnd:被測試窗口的句柄。
返回值:若是窗口己最大化,則返回值爲非零;若是窗口未最大化,則返回值爲零。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:不支持;頭文件:Winuer.h;庫文件:User32.Iib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MoveWindow
函數功能:該函數改變指定窗口的位置和尺寸。對於頂層窗口,位置和尺寸是相對於屏幕的左上角的:對於子窗口,位置和尺寸是相對於父窗口客戶區的左上角座標的。
函數原型:BOOL MoveWindow(HWND hWnd.int x.int y,int nWidth,int nHeight,BOOL BRePaint);
參數:
hWnd:窗口句柄。
x:指定窗口的新位置的左邊界。
Y:指定窗口的新位置的頂部邊界。
nWidth:指定窗口的新的寬度。
nHaight:指定窗口的新的高度。
bRepaint: 肯定窗口是否被刷新。若是該參數爲TRUE,窗口接收一個WM_PAINT消息;若是參數爲FALSE,不發生任何刷新動做。它適用於客戶區,非客戶區(包括標題欄和滾動條),及因爲移動子窗口而露出的父窗口的區域。若是參數爲FALSE,應用程序就必須明確地使窗口無效或重畫該窗口和須要刷新的父窗口。
返回值:若是函數成功,返回值爲非零;若是函數失敗,返回值爲零。若想得到更多錯誤信息,請調用GetLastError函數。
備註:若是bRepaint爲TRUE,系統在窗口移動後當即給窗口過程發送WM_PAINT消息(即由MoveWindow函數調用 UPdateWindow函數)。若是bRepaint 爲FALSE,系統將WM_PAINT消息放在該窗口的消息隊列中。消息循環只有在派遣完消息隊列中的其餘消息時纔派遣WM_PAINT消息。
MoveWindow給窗口發送WM_WfNOWPOSCHANGING,WM_WINDOWPOSCHANGED,WM_MOVE,WM_SIZE和WM_NCCALCSIZE消息,
速查:Windows NT:3.1以上版本:Windows:95以上版本;Windows CE:1.0以上版本:頭文件:winuser.h;庫文件:user32.lib。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Openlcon
函數功能:該函數將一個最小化窗口恢復到原來的位置和尺寸而且激活該窗口。
函數原型:BOOL Openlcon(HWNDhWnd);
參數:
hWnd:被恢復與激活的窗口的句柄。
返回值:若是函數成功,返回值爲非零;若是函數失敗,返回值爲零。若想得到更多錯誤信息,請調用GetLastError函數。
備註:Openlcon向給出的窗口發送WM_QUERYOPEN消息。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:不支持:頭文件:winuser.h;庫文件:user32.lib。緩存

相關文章
相關標籤/搜索