using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WindowsAPI
{
class CSharp_Win32Api
{
#region User32.dll 函數
///
/// 該函數檢索一指定窗口的客戶區域或整個屏幕的顯示設備上下文環境的句柄,以后可以在GDI函數中使用該句柄來在設備上下文環境中繪圖。hWnd:設備上下文環境被檢索的窗口的句柄
///
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetDC(IntPtr hWnd);
///
/// 函數釋放設備上下文環境(DC)供其他應用程序使用。
///
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
///
/// 該函數返回桌面窗口的句柄。桌面窗口覆蓋整個屏幕。
///
static public extern IntPtr GetDesktopWindow();
///
/// 該函數設置指定窗口的顯示狀態。
///
static public extern bool ShowWindow(IntPtr hWnd, short State);
///
/// 通過發送重繪消息 WM_PAINT 給目標窗體來更新目標窗體客戶區的無效區域。
///
static public extern bool UpdateWindow(IntPtr hWnd);
///
/// 該函數將創建指定窗口的線程設置到前臺,并且激活該窗口。鍵盤輸入轉向該窗口,并為用戶改各種可視的記號。系統給創建前臺窗口的線程分配的權限稍高于其他線程。
///
static public extern bool SetForegroundWindow(IntPtr hWnd);
///
/// 該函數改變一個子窗口,彈出式窗口式頂層窗口的尺寸,位置和Z序。
///
static public extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, intx, int y, int Width, int Height, uint flags);
///
/// 打開剪切板
///
static public extern bool OpenClipboard(IntPtr hWndNewOwner);
///
/// 關閉剪切板
///
static public extern bool CloseClipboard();
///
/// 打開清空
static public extern bool EmptyClipboard();
///
/// 將存放有數據的內存塊放入剪切板的資源管理中
///
static public extern IntPtr SetClipboardData(uint Format, IntPtr hData);
///
/// 在一個矩形中裝載指定菜單條目的屏幕坐標信息
///
static public extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, uint Item,ref RECT rc);
[DllImport("user32.dll", ExactSpelling = true, CharSet =CharSet.Auto)]
///
/// 該函數獲得一個指定子窗口的父窗口句柄。
///
public static extern IntPtr GetParent(IntPtr hWnd);
///
/// 該函數將指定的消息發送到一個或多個窗口。此函數為指定的窗口調用窗口程序,直到窗口程序處理完消息再返回。
///
/// 其窗口程序將接收消息的窗口的句柄
/// 指定被發送的消息
/// 指定附加的消息指定信息
/// 指定附加的消息指定信息
///
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, intlParam);
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam,IntPtr lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refRECT lParam);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, refPOINT lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTBBUTTON lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTBBUTTONINFO lParam);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, refREBARBANDINFO lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTVITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refLVITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refHDITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refHD_HITTESTINFO hti);
///
/// 該函數將一個消息放入(寄送)到與指定窗口創建的線程相聯系消息隊列里
///
public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, intlParam);
public static extern IntPtr SetWindowsHookEx(int hookid, HookPRoc pfnhook,IntPtr hinst, int threadid);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling =true)]
public static extern bool UnhookWindowsHookEx(IntPtr hhook);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling =true)]
public static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wparam,IntPtr lparam);
///
/// 該函數對指定的窗口設置鍵盤焦點。
///
public static extern IntPtr SetFocus(IntPtr hWnd);
///
/// 該函數在指定的矩形里寫入格式化文本,根據指定的方法對文本格式化(擴展的制表符,字符對齊、折行等)。
///
public extern static int DrawText(IntPtr hdc, string lpString, int nCount, refRECT lpRect, int uFormat);
///
/// 該函數改變指定子窗口的父窗口。
///
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
///
/// 獲取對話框中子窗口控件的句柄
///
public extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID);
///
/// 該函數獲取窗口客戶區的坐標。
///
public extern static int GetClientRect(IntPtr hWnd, ref RECT rc);
///
/// 該函數向指定的窗體添加一個矩形,然后窗口客戶區域的這一部分將被重新繪制。
///
public extern static int InvalidateRect(IntPtr hWnd, IntPtr rect, int bErase);
///
/// 該函數產生對其他線程的控制,如果一個線程沒有其他消息在其消息隊列里。
///
public static extern bool WaitMessage();
///
/// 該函數為一個消息檢查線程消息隊列,并將該消息(如果存在)放于指定的結構。
///
public static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin,uint wFilterMax, uint wFlag);
///
/// 該函數從調用線程的消息隊列里取得一個消息并將其放于指定的結構。此函數可取得與指定窗口聯系的消息和由PostThreadMesssge寄送的線程消息。此函數接收一定范圍的消息值。
///
public static extern bool GetMessage(ref MSG msg, int hWnd, uint wFilterMin,uint wFilterMax);
///
/// 該函數將虛擬鍵消息轉換為字符消息。
///
public static extern bool TranslateMessage(ref MSG msg);
///
/// 該函數調度一個消息給窗口程序。
///
public static extern bool DispatchMessage(ref MSG msg);
///
/// 該函數從一個與應用事例相關的可執行文件(EXE文件)中載入指定的光標資源.
///
public static extern IntPtr LoadCursor(IntPtr hInstance, uint cursor);
///
/// 該函數確定光標的形狀。
///
public static extern IntPtr SetCursor(IntPtr hCursor);
///
/// 確定當前焦點位于哪個控件上。
///
public static extern IntPtr GetFocus();
///
/// 該函數從當前線程中的窗口釋放鼠標捕獲,并恢復通常的鼠標輸入處理。捕獲鼠標的窗口接收所有的鼠標輸入(無論光標的位置在哪里),除非點擊鼠標鍵時,光標熱點在另一個線程的窗口中。
///
public static extern bool ReleaseCapture();
///
/// 準備指定的窗口來重繪并將繪畫相關的信息放到一個PAINTSTRUCT結構中。
///
public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
///
/// 標記指定窗口的繪畫過程結束,每次調用BeginPaint函數之后被請求
///
public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
///
/// 半透明窗體
///
public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINTPPTDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pprSrc, Int32 crKey, refBLENDFUNCTION pblend, Int32 dwFlags);
///
/// 該函數返回指定窗口的邊框矩形的尺寸。該尺寸以相對于屏幕坐標左上角的屏幕坐標給出。
///
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
///
/// 該函數將指定點的用戶坐標轉換成屏幕坐標。
///
public static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
///
/// 當在指定時間內鼠標指針離開或盤旋在一個窗口上時,此函數寄送消息。
///
public static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
///
///
///
public static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
///
/// 該函數檢取指定虛擬鍵的狀態。
///
public static extern ushort GetKeyState(int virtKey);
///
/// 該函數改變指定窗口的位置和尺寸。對于頂層窗口,位置和尺寸是相對于屏幕的左上角的:對于子窗口,位置和尺寸是相對于父窗口客戶區的左上角坐標的。
///
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, intheight, bool repaint);
///
/// 該函數獲得指定窗口所屬的類的類名。
///
public static extern int GetClassName(IntPtr hWnd, out STRINGBUFFER ClassName,int nMaxCount);
///
/// 該函數改變指定窗口的屬性
///
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
///
/// 該函數檢索指定窗口客戶區域或整個屏幕的顯示設備上下文環境的句柄,在隨后的GDI函數中可以使用該句柄在設備上下文環境中繪圖。
///
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, uint flags);
///
/// 獲取整個窗口(包括邊框、滾動條、標題欄、菜單等)的設備場景 返回值 Long。
///
public static extern IntPtr GetWindowDC(IntPtr hWnd);
///
/// 該函數用指定的畫刷填充矩形,此函數包括矩形的左上邊界,但不包括矩形的右下邊界。
///
public static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);
///
/// 該函數返回指定窗口的顯示狀態以及被恢復的、最大化的和最小化的窗口位置。
///
public static extern int GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENTwp);
///
/// 該函數改變指定窗口的標題欄的文本內容
///
public static extern int SetWindowText(IntPtr hWnd, string text);
///
/// 該函數將指定窗口的標題條文本(如果存在)拷貝到一個緩存區內。如果指定的窗口是一個控制,則拷貝控制的文本。
///
public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER text, intmaxCount);
///
/// 用于得到被定義的系統數據或者系統配置信息.
///
static public extern int GetSystemMetrics(int nIndex);
///
/// 該函數設置滾動條參數,包括滾動位置的最大值和最小值,頁面大小,滾動按鈕的位置。
///
static public extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si,int fRedraw);
///
/// 該函數顯示或隱藏所指定的滾動條。
///
public static extern int ShowScrollBar(IntPtr hWnd, int bar, int show);
///
/// 該函數可以激活一個或兩個滾動條箭頭或是使其失效。
///
public static extern int EnableScrollBar(IntPtr hWnd, uint flags, uint arrows);
///
/// 該函數將指定的窗口設置到Z序的頂部。
///
public static extern int BringWindowToTop(IntPtr hWnd);
///
/// 該函數滾動指定窗體客戶區域的目錄。
///
static public extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy,ref RECTrcScroll, ref RECT rcClip, IntPtr UpdateRegion, ref RECT rcInvalidated, uintflags);
///
/// 該函數確定給定的窗口句柄是否識別一個已存在的窗口。
///
public static extern int IsWindow(IntPtr hWnd);
///
/// 該函數將256個虛擬鍵的狀態拷貝到指定的緩沖區中。
///
public static extern int GetKeyboardState(byte[] pbKeyState);
///
/// 該函數將指定的虛擬鍵碼和鍵盤狀態翻譯為相應的字符或字符串。該函數使用由給定的鍵盤布局句柄標識的物理鍵盤布局和輸入語言來翻譯代碼。
///
public static extern int ToAscii(int uVirtKey,int uScanCode, byte[]lpbKeyState, byte[] lpwTransKey,int fuState);
#endregion
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WindowsAPI
{
class CSharp_Win32Api
{
#region User32.dll 函數
///
/// 該函數檢索一指定窗口的客戶區域或整個屏幕的顯示設備上下文環境的句柄,以后可以在GDI函數中使用該句柄來在設備上下文環境中繪圖。hWnd:設備上下文環境被檢索的窗口的句柄
///
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetDC(IntPtr hWnd);
///
/// 函數釋放設備上下文環境(DC)供其他應用程序使用。
///
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
///
/// 該函數返回桌面窗口的句柄。桌面窗口覆蓋整個屏幕。
///
static public extern IntPtr GetDesktopWindow();
///
/// 該函數設置指定窗口的顯示狀態。
///
static public extern bool ShowWindow(IntPtr hWnd, short State);
///
/// 通過發送重繪消息 WM_PAINT 給目標窗體來更新目標窗體客戶區的無效區域。
///
static public extern bool UpdateWindow(IntPtr hWnd);
///
/// 該函數將創建指定窗口的線程設置到前臺,并且激活該窗口。鍵盤輸入轉向該窗口,并為用戶改各種可視的記號。系統給創建前臺窗口的線程分配的權限稍高于其他線程。
///
static public extern bool SetForegroundWindow(IntPtr hWnd);
///
/// 該函數改變一個子窗口,彈出式窗口式頂層窗口的尺寸,位置和Z序。
///
static public extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, intx, int y, int Width, int Height, uint flags);
///
/// 打開剪切板
///
static public extern bool OpenClipboard(IntPtr hWndNewOwner);
///
/// 關閉剪切板
///
static public extern bool CloseClipboard();
///
/// 打開清空
static public extern bool EmptyClipboard();
///
/// 將存放有數據的內存塊放入剪切板的資源管理中
///
static public extern IntPtr SetClipboardData(uint Format, IntPtr hData);
///
/// 在一個矩形中裝載指定菜單條目的屏幕坐標信息
///
static public extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, uint Item,ref RECT rc);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
///
/// 該函數獲得一個指定子窗口的父窗口句柄。
///
public static extern IntPtr GetParent(IntPtr hWnd);
///
/// 該函數將指定的消息發送到一個或多個窗口。此函數為指定的窗口調用窗口程序,直到窗口程序處理完消息再返回。
///
/// 其窗口程序將接收消息的窗口的句柄
/// 指定被發送的消息
/// 指定附加的消息指定信息
/// 指定附加的消息指定信息
///
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, intlParam);
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam,IntPtr lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refRECT lParam);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, refPOINT lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTBBUTTON lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTBBUTTONINFO lParam);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, refREBARBANDINFO lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refTVITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refLVITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refHDITEM lParam);
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, refHD_HITTESTINFO hti);
///
/// 該函數將一個消息放入(寄送)到與指定窗口創建的線程相聯系消息隊列里
///
public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, intlParam);
public static extern IntPtr SetWindowsHookEx(int hookid, HookProc pfnhook,IntPtr hinst, int threadid);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling =true)]
public static extern bool UnhookWindowsHookEx(IntPtr hhook);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling =true)]
public static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtrwparam, IntPtr lparam);
///
/// 該函數對指定的窗口設置鍵盤焦點。
///
public static extern IntPtr SetFocus(IntPtr hWnd);
///
/// 該函數在指定的矩形里寫入格式化文本,根據指定的方法對文本格式化(擴展的制表符,字符對齊、折行等)。
///
public extern static int DrawText(IntPtr hdc, string lpString, int nCount, refRECT lpRect, int uFormat);
///
/// 該函數改變指定子窗口的父窗口。
///
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
///
/// 獲取對話框中子窗口控件的句柄
///
public extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID);
///
/// 該函數獲取窗口客戶區的坐標。
///
public extern static int GetClientRect(IntPtr hWnd, ref RECT rc);
///
/// 該函數向指定的窗體添加一個矩形,然后窗口客戶區域的這一部分將被重新繪制。
///
public extern static int InvalidateRect(IntPtr hWnd, IntPtr rect, int bErase);
///
/// 該函數產生對其他線程的控制,如果一個線程沒有其他消息在其消息隊列里。
///
public static extern bool WaitMessage();
///
/// 該函數為一個消息檢查線程消息隊列,并將該消息(如果存在)放于指定的結構。
///
public static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin,uint wFilterMax, uint wFlag);
///
/// 該函數從調用線程的消息隊列里取得一個消息并將其放于指定的結構。此函數可取得與指定窗口聯系的消息和由PostThreadMesssge寄送的線程消息。此函數接收一定范圍的消息值。
///
public static extern bool GetMessage(ref MSG msg, int hWnd, uint wFilterMin,uint wFilterMax);
///
/// 該函數將虛擬鍵消息轉換為字符消息。
///
public static extern bool TranslateMessage(ref MSG msg);
///
/// 該函數調度一個消息給窗口程序。
///
public static extern bool DispatchMessage(ref MSG msg);
///
/// 該函數從一個與應用事例相關的可執行文件(EXE文件)中載入指定的光標資源.
///
public static extern IntPtr LoadCursor(IntPtr hInstance, uint cursor);
///
/// 該函數確定光標的形狀。
///
public static extern IntPtr SetCursor(IntPtr hCursor);
///
/// 確定當前焦點位于哪個控件上。
///
public static extern IntPtr GetFocus();
///
/// 該函數從當前線程中的窗口釋放鼠標捕獲,并恢復通常的鼠標輸入處理。捕獲鼠標的窗口接收所有的鼠標輸入(無論光標的位置在哪里),除非點擊鼠標鍵時,光標熱點在另一個線程的窗口中。
///
public static extern bool ReleaseCapture();
///
/// 準備指定的窗口來重繪并將繪畫相關的信息放到一個PAINTSTRUCT結構中。
///
public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
///
/// 標記指定窗口的繪畫過程結束,每次調用BeginPaint函數之后被請求
///
public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
///
/// 半透明窗體
///
public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, refPOINT pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pprSrc, Int32 crKey, refBLENDFUNCTION pblend, Int32 dwFlags);
///
/// 該函數返回指定窗口的邊框矩形的尺寸。該尺寸以相對于屏幕坐標左上角的屏幕坐標給出。
///
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
///
/// 該函數將指定點的用戶坐標轉換成屏幕坐標。
///
public static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
///
/// 當在指定時間內鼠標指針離開或盤旋在一個窗口上時,此函數寄送消息。
///
public static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
///
///
///
public static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
///
/// 該函數檢取指定虛擬鍵的狀態。
///
public static extern ushort GetKeyState(int virtKey);
///
/// 該函數改變指定窗口的位置和尺寸。對于頂層窗口,位置和尺寸是相對于屏幕的左上角的:對于子窗口,位置和尺寸是相對于父窗口客戶區的左上角坐標的。
///
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, intheight, bool repaint);
///
/// 該函數獲得指定窗口所屬的類的類名。
///
public static extern int GetClassName(IntPtr hWnd, out STRINGBUFFER ClassName,int nMaxCount);
///
/// 該函數改變指定窗口的屬性
///
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
///
/// 該函數檢索指定窗口客戶區域或整個屏幕的顯示設備上下文環境的句柄,在隨后的GDI函數中可以使用該句柄在設備上下文環境中繪圖。
///
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, uint flags);
///
/// 獲取整個窗口(包括邊框、滾動條、標題欄、菜單等)的設備場景 返回值 Long。
///
public static extern IntPtr GetWindowDC(IntPtr hWnd);
///
/// 該函數用指定的畫刷填充矩形,此函數包括矩形的左上邊界,但不包括矩形的右下邊界。
///
public static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);
///
/// 該函數返回指定窗口的顯示狀態以及被恢復的、最大化的和最小化的窗口位置。
///
public static extern int GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENTwp);
///
/// 該函數改變指定窗口的標題欄的文本內容
///
public static extern int SetWindowText(IntPtr hWnd, string text);
///
/// 該函數將指定窗口的標題條文本(如果存在)拷貝到一個緩存區內。如果指定的窗口是一個控制,則拷貝控制的文本。
///
public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER text, intmaxCount);
///
/// 用于得到被定義的系統數據或者系統配置信息.
///
static public extern int GetSystemMetrics(int nIndex);
///
/// 該函數設置滾動條參數,包括滾動位置的最大值和最小值,頁面大小,滾動按鈕的位置。
///
static public extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si,int fRedraw);
///
/// 該函數顯示或隱藏所指定的滾動條。
///
public static extern int ShowScrollBar(IntPtr hWnd, int bar, int show);
///
/// 該函數可以激活一個或兩個滾動條箭頭或是使其失效。
///
public static extern int EnableScrollBar(IntPtr hWnd, uint flags, uint arrows);
///
/// 該函數將指定的窗口設置到Z序的頂部。
///
public static extern int BringWindowToTop(IntPtr hWnd);
///
/// 該函數滾動指定窗體客戶區域的目錄。
///
static public extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy,ref RECTrcScroll, ref RECT rcClip, IntPtr UpdateRegion, ref RECT rcInvalidated, uintflags);
///
/// 該函數確定給定的窗口句柄是否識別一個已存在的窗口。
///
public static extern int IsWindow(IntPtr hWnd);
///
/// 該函數將256個虛擬鍵的狀態拷貝到指定的緩沖區中。
///
public static extern int GetKeyboardState(byte[] pbKeyState);
///
/// 該函數將指定的虛擬鍵碼和鍵盤狀態翻譯為相應的字符或字符串。該函數使用由給定的鍵盤布局句柄標識的物理鍵盤布局和輸入語言來翻譯代碼。
///
public static extern int ToAscii(int uVirtKey,int uScanCode, byte[]lpbKeyState, byte[] lpwTransKey,int fuState);
#endregion
}
新聞熱點
疑難解答