小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

常用Win32API 封裝 Win32api for .net

 Jcstone 2013-04-17

 /// <summary>
 /// Windows API Functions
 /// </summary>
 public class Win32API
 {
  #region .ctor()
  // No need to construct this object
  private Win32API()
  {
  }
  #endregion
  
  #region Constans values
  public const string TOOLBARCLASSNAME = "ToolbarWindow32";
  public const string REBARCLASSNAME = "ReBarWindow32";
  public const string PROGRESSBARCLASSNAME = "msctls_progress32";
  public const string SCROLLBAR = "SCROLLBAR";
  #endregion

  #region CallBacks
  public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
  #endregion

  #region Kernel32.dll functions
  [DllImport("kernel32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
   public static extern int GetCurrentThreadId();
  #endregion
 
  #region Gdi32.dll functions
  [DllImport("gdi32.dll")]
   static public extern bool StretchBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
   IntPtr hDCSrc,  int XOriginScr, int YOriginSrc, int WidthScr, int HeightScr, uint Rop);
  [DllImport("gdi32.dll")]
   static public extern IntPtr CreateCompatibleDC(IntPtr hDC);
  [DllImport("gdi32.dll")]
   static public extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int Width, int Heigth);
  [DllImport("gdi32.dll")]
   static public extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
  [DllImport("gdi32.dll")]
   static public extern bool BitBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
   IntPtr hDCSrc,  int XOriginScr, int YOriginSrc, uint Rop);
  [DllImport("gdi32.dll")]
   static public extern IntPtr DeleteDC(IntPtr hDC);
  [DllImport("gdi32.dll")]
   static public extern bool PatBlt(IntPtr hDC, int XLeft, int YLeft, int Width, int Height, uint Rop);
  [DllImport("gdi32.dll")]
   static public extern bool DeleteObject(IntPtr hObject);
  [DllImport("gdi32.dll")]
   static public extern uint GetPixel(IntPtr hDC, int XPos, int YPos);
  [DllImport("gdi32.dll")]
   static public extern int SetMapMode(IntPtr hDC, int fnMapMode);
  [DllImport("gdi32.dll")]
   static public extern int GetObjectType(IntPtr handle);
  [DllImport("gdi32")]
   public static extern IntPtr CreateDIBSection(IntPtr hdc, ref BITMAPINFO_FLAT bmi,
   int iUsage, ref int ppvBits, IntPtr hSection, int dwOffset);
  [DllImport("gdi32")]
   public static extern int GetDIBits(IntPtr hDC, IntPtr hbm, int StartScan, int ScanLines, int lpBits, BITMAPINFOHEADER bmi, int usage);
  [DllImport("gdi32")]
   public static extern int GetDIBits(IntPtr hdc, IntPtr hbm, int StartScan, int ScanLines, int lpBits, ref BITMAPINFO_FLAT bmi, int usage);
  [DllImport("gdi32")]
   public static extern IntPtr GetPaletteEntries(IntPtr hpal, int iStartIndex, int nEntries, byte[] lppe);
  [DllImport("gdi32")]
   public static extern IntPtr GetSystemPaletteEntries(IntPtr hdc, int iStartIndex, int nEntries, byte[] lppe);
  [DllImport("gdi32")]
   public static extern uint SetDCBrushColor(IntPtr hdc,  uint crColor);
  [DllImport("gdi32")]
   public static extern IntPtr CreateSolidBrush(uint crColor);
  [DllImport("gdi32")]
   public static extern int SetBkMode(IntPtr hDC, BackgroundMode mode);
  [DllImport("gdi32")]
   public static extern int SetViewportOrgEx(IntPtr hdc,  int x, int y,  int param);
  [DllImport("gdi32")]
   public static extern uint SetTextColor(IntPtr hDC, uint colorRef);
  [DllImport("gdi32")]
   public static extern int SetStretchBltMode(IntPtr hDC, int StrechMode);
  #endregion

  #region Uxtheme.dll functions
  [DllImport("uxtheme.dll")]
  static public extern int SetWindowTheme(IntPtr hWnd, string AppID, string ClassID);
  #endregion

        #region User32.dll 函數(shù)

        #region 預(yù)定義

        public static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
        public static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
        public static readonly IntPtr HWND_TOP = new IntPtr(0);
        public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
        public static readonly UInt32 SWP_NOSIZE = 1;
        public static readonly UInt32 SWP_NOMOVE = 2;
        public static readonly UInt32 SWP_NOZORDER = 4;
        public static readonly UInt32 SWP_NOREDRAW = 8;
        public static readonly UInt32 SWP_NOACTIVATE = 16;
        public static readonly UInt32 SWP_FRAMECHANGED = 32;
        public static readonly UInt32 SWP_SHOWWINDOW = 64;
        public static readonly UInt32 SWP_HIDEWINDOW = 128;
        public static readonly UInt32 SWP_NOCOPYBITS = 256;
        public static readonly UInt32 SWP_NOOWNERZORDER = 512;
        public static readonly UInt32 SWP_NOSENDCHANGING = 1024;

        #endregion

 

        /// <summary>   
        /// 該函數(shù)檢索一指定窗口的客戶區(qū)域或整個(gè)屏幕的顯示設(shè)備上下文環(huán)境的句柄,以后可以在GDI函數(shù)中使用該句柄來在設(shè)備上下文環(huán)境中繪圖。
        /// hWnd:設(shè)備上下文環(huán)境被檢索的窗口的句柄   
        /// </summary>   
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetDC(IntPtr hWnd);
        /// <summary>   
        /// 函數(shù)釋放設(shè)備上下文環(huán)境(DC)供其他應(yīng)用程序使用。   
        /// </summary>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
        /// <summary>   
        /// 該函數(shù)返回桌面窗口的句柄。桌面窗口覆蓋整個(gè)屏幕。   
        /// </summary>   
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        static public extern IntPtr GetDesktopWindow();
        /// <summary>   
        /// 該函數(shù)設(shè)置指定窗口的顯示狀態(tài)。   
        /// </summary>   
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        static public extern bool ShowWindow(IntPtr hWnd, short State);
        /// <summary>   
        /// 通過發(fā)送重繪消息 WM_PAINT 給目標(biāo)窗體來更新目標(biāo)窗體客戶區(qū)的無效區(qū)域。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool UpdateWindow(IntPtr hWnd);
        /// <summary>   
        /// 該函數(shù)將創(chuàng)建指定窗口的線程設(shè)置到前臺(tái),并且激活該窗口。鍵盤輸入轉(zhuǎn)向該窗口,并為用戶改各種可視的記號。系統(tǒng)給創(chuàng)建前臺(tái)窗口的線程分配的權(quán)限稍高于其他線程。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool SetForegroundWindow(IntPtr hWnd);

 

        /// <summary>   
        /// 該函數(shù)改變一個(gè)子窗口,彈出式窗口式頂層窗口的尺寸,位置和Z序。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, uint flags);

        /// <summary>
        /// 根據(jù)坐標(biāo)獲取窗體
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        [DllImport("user32", CharSet = CharSet.Auto)]       
        public extern static IntPtr WindowFromPoint(Point p);

        /// <summary>   
        /// 打開剪切板   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool OpenClipboard(IntPtr hWndNewOwner);
        /// <summary>   
        /// 關(guān)閉剪切板   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool CloseClipboard();
        /// <summary>   
        /// 打開清空</summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool EmptyClipboard();
        /// <summary>   
        /// 將存放有數(shù)據(jù)的內(nèi)存塊放入剪切板的資源管理中   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern IntPtr SetClipboardData(uint Format, IntPtr hData);
        /// <summary>   
        /// 在一個(gè)矩形中裝載指定菜單條目的屏幕坐標(biāo)信息    
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, uint Item, ref RECT rc);

       
        /// <summary>   
        /// 該函數(shù)獲得一個(gè)指定子窗口的父窗口句柄。   
        /// </summary>   
        [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
        public static extern IntPtr GetParent(IntPtr hWnd);
       
        /// <summary>   
        /// 該函數(shù)將指定的消息發(fā)送到一個(gè)或多個(gè)窗口。此函數(shù)為指定的窗口調(diào)用窗口程序,直到窗口程序處理完消息再返回?!?nbsp;  
        /// </summary>   
        /// <param name="hWnd">其窗口程序?qū)⒔邮障⒌拇翱诘木浔?lt;/param>   
        /// <param name="msg">指定被發(fā)送的消息</param>   
        /// <param name="wParam">指定附加的消息指定信息</param>   
        /// <param name="lParam">指定附加的消息指定信息</param>   
        /// <returns></returns>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref POINT lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref TBBUTTON lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref TBBUTTONINFO lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref REBARBANDINFO lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref TVITEM lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref LVITEM lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref HDITEM lParam);
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref HD_HITTESTINFO hti);
      

        /// <summary>   
        /// 該函數(shù)將一個(gè)消息放入(寄送)到與指定窗口創(chuàng)建的線程相聯(lián)系消息隊(duì)列里   
        /// </summary> 
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr PostMessage(int hWnd, int msg, int wParam, int lParam);


        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetWindowsHookEx(int hookid, Win32Lib.Win32API.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);
        /// <summary>   
        /// 該函數(shù)對指定的窗口設(shè)置鍵盤焦點(diǎn)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetFocus(IntPtr hWnd);
        /// <summary>   
        /// 該函數(shù)在指定的矩形里寫入格式化文本,根據(jù)指定的方法對文本格式化(擴(kuò)展的制表符,字符對齊、折行等)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public extern static int DrawText(IntPtr hdc, string lpString, int nCount, ref RECT lpRect, int uFormat);
        /// <summary>   
        /// 該函數(shù)改變指定子窗口的父窗口。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
        /// <summary>   
        /// 獲取對話框中子窗口控件的句柄   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID);
        /// <summary>   
        /// 該函數(shù)獲取窗口客戶區(qū)的坐標(biāo)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public extern static int GetClientRect(IntPtr hWnd, ref RECT rc);
        /// <summary>   
        /// 該函數(shù)向指定的窗體添加一個(gè)矩形,然后窗口客戶區(qū)域的這一部分將被重新繪制。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public extern static int InvalidateRect(IntPtr hWnd, IntPtr rect, int bErase);
        /// <summary>   
        /// 該函數(shù)產(chǎn)生對其他線程的控制,如果一個(gè)線程沒有其他消息在其消息隊(duì)列里。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool WaitMessage();
        /// <summary>   
        /// 該函數(shù)為一個(gè)消息檢查線程消息隊(duì)列,并將該消息(如果存在)放于指定的結(jié)構(gòu)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax, uint wFlag);
        /// <summary>   
        /// 該函數(shù)從調(diào)用線程的消息隊(duì)列里取得一個(gè)消息并將其放于指定的結(jié)構(gòu)。此函數(shù)可取得與指定窗口聯(lián)系的消息和由PostThreadMesssge寄送的線程消息。此函數(shù)接收一定范圍的消息值。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax);
        /// <summary>   
        /// 該函數(shù)將虛擬鍵消息轉(zhuǎn)換為字符消息。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool TranslateMessage(ref MSG msg);
        /// <summary>   
        /// 該函數(shù)調(diào)度一個(gè)消息給窗口程序。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool DispatchMessage(ref MSG msg);
        /// <summary>   
        /// 該函數(shù)從一個(gè)與應(yīng)用事例相關(guān)的可執(zhí)行文件(EXE文件)中載入指定的光標(biāo)資源.   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr LoadCursor(IntPtr hInstance, uint cursor);
        /// <summary>   
        /// 該函數(shù)確定光標(biāo)的形狀。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetCursor(IntPtr hCursor);
        /// <summary>   
        /// 確定當(dāng)前焦點(diǎn)位于哪個(gè)控件上。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetFocus();
        /// <summary>   
        /// 該函數(shù)從當(dāng)前線程中的窗口釋放鼠標(biāo)捕獲,并恢復(fù)通常的鼠標(biāo)輸入處理。捕獲鼠標(biāo)的窗口接收所有的鼠標(biāo)輸入(無論光標(biāo)的位置在哪里),除非點(diǎn)擊鼠標(biāo)鍵時(shí),光標(biāo)熱點(diǎn)在另一個(gè)線程的窗口中。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool ReleaseCapture();
        /// <summary>   
        /// 準(zhǔn)備指定的窗口來重繪并將繪畫相關(guān)的信息放到一個(gè)PAINTSTRUCT結(jié)構(gòu)中。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
        /// <summary>   
        /// 標(biāo)記指定窗口的繪畫過程結(jié)束,每次調(diào)用BeginPaint函數(shù)之后被請求   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
        /// <summary>   
        /// 半透明窗體   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINT pptDst, ref Size psize, IntPtr hdcSrc, ref POINT pprSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags);
        /// <summary>   
        /// 該函數(shù)返回指定窗口的邊框矩形的尺寸。該尺寸以相對于屏幕坐標(biāo)左上角的屏幕坐標(biāo)給出。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
        /// <summary>   
        /// 該函數(shù)將指定點(diǎn)的用戶坐標(biāo)轉(zhuǎn)換成屏幕坐標(biāo)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
        /// <summary>   
        /// 當(dāng)在指定時(shí)間內(nèi)鼠標(biāo)指針離開或盤旋在一個(gè)窗口上時(shí),此函數(shù)寄送消息。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
        /// <summary>   
        ///    
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
        /// <summary>   
        /// 該函數(shù)檢取指定虛擬鍵的狀態(tài)。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern ushort GetKeyState(int virtKey);
        /// <summary>   
        /// 該函數(shù)改變指定窗口的位置和尺寸。對于頂層窗口,位置和尺寸是相對于屏幕的左上角的:對于子窗口,位置和尺寸是相對于父窗口客戶區(qū)的左上角坐標(biāo)的。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
        /// <summary>   
        /// 該函數(shù)獲得指定窗口所屬的類的類名。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int GetClassName(IntPtr hWnd, out STRINGBUFFER ClassName, int nMaxCount);
        /// <summary>   
        /// 該函數(shù)改變指定窗口的屬性   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
        /// <summary>   
        /// 該函數(shù)檢索指定窗口客戶區(qū)域或整個(gè)屏幕的顯示設(shè)備上下文環(huán)境的句柄,在隨后的GDI函數(shù)中可以使用該句柄在設(shè)備上下文環(huán)境中繪圖。 
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, uint flags);
        /// <summary>   
        /// 獲取整個(gè)窗口(包括邊框、滾動(dòng)條、標(biāo)題欄、菜單等)的設(shè)備場景 返回值 Long。   
        /// </summary>   
       [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetWindowDC(IntPtr hWnd);
        /// <summary>   
        /// 該函數(shù)用指定的畫刷填充矩形,此函數(shù)包括矩形的左上邊界,但不包括矩形的右下邊界。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);
        /// <summary>   
        /// 該函數(shù)返回指定窗口的顯示狀態(tài)以及被恢復(fù)的、最大化的和最小化的窗口位置。   
        /// </summary>   
       [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT wp);
        /// <summary>   
        /// 該函數(shù)改變指定窗口的標(biāo)題欄的文本內(nèi)容   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int SetWindowText(IntPtr hWnd, string text);
        /// <summary>   
        /// 該函數(shù)將指定窗口的標(biāo)題條文本(如果存在)拷貝到一個(gè)緩存區(qū)內(nèi)。如果指定的窗口是一個(gè)控制,則拷貝控制的文本。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER text, int maxCount);
        /// <summary>   
        /// 用于得到被定義的系統(tǒng)數(shù)據(jù)或者系統(tǒng)配置信息.   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static   extern int GetSystemMetrics(int nIndex);
        /// <summary>   
        /// 該函數(shù)設(shè)置滾動(dòng)條參數(shù),包括滾動(dòng)位置的最大值和最小值,頁面大小,滾動(dòng)按鈕的位置。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si, int fRedraw);
        /// <summary>   
        /// 該函數(shù)顯示或隱藏所指定的滾動(dòng)條。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int ShowScrollBar(IntPtr hWnd, int bar, int show);
        /// <summary>   
        /// 該函數(shù)可以激活一個(gè)或兩個(gè)滾動(dòng)條箭頭或是使其失效。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int EnableScrollBar(IntPtr hWnd, uint flags, uint arrows);
        /// <summary>   
        /// 該函數(shù)將指定的窗口設(shè)置到Z序的頂部。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int BringWindowToTop(IntPtr hWnd);
        /// <summary>   
        /// 該函數(shù)滾動(dòng)指定窗體客戶區(qū)域的目錄。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        static public extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, ref RECT rcScroll, ref RECT rcClip, IntPtr UpdateRegion, ref RECT rcInvalidated, uint flags);
        /// <summary>   
        /// 該函數(shù)確定給定的窗口句柄是否識別一個(gè)已存在的窗口。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int IsWindow(IntPtr hWnd);
        /// <summary>   
        /// 該函數(shù)將256個(gè)虛擬鍵的狀態(tài)拷貝到指定的緩沖區(qū)中。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int GetKeyboardState(byte[] pbKeyState);
        /// <summary>   
        /// 該函數(shù)將指定的虛擬鍵碼和鍵盤狀態(tài)翻譯為相應(yīng)的字符或字符串。該函數(shù)使用由給定的鍵盤布局句柄標(biāo)識的物理鍵盤布局和輸入語言來翻譯代碼。   
        /// </summary>   
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern int ToAscii(int uVirtKey, int uScanCode, byte[] lpbKeyState, byte[] lpwTransKey, int fuState);
        #endregion

  #region Common Controls functions
  [DllImport("comctl32.dll")]
   public static extern bool InitCommonControlsEx(INITCOMMONCONTROLSEX icc);
  [DllImport("comctl32.dll")]
   public static extern bool InitCommonControls();
  [DllImport("comctl32.dll", EntryPoint="DllGetVersion")]
   public extern static int GetCommonControlDLLVersion(ref DLLVERSIONINFO dvi);
  [DllImport("comctl32.dll")]
   public static extern IntPtr ImageList_Create(int width, int height, uint flags, int count, int grow);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_Destroy(IntPtr handle);
  [DllImport("comctl32.dll")]
   public static extern int ImageList_Add(IntPtr imageHandle, IntPtr hBitmap, IntPtr hMask);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_Remove(IntPtr imageHandle, int index);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_BeginDrag(IntPtr imageHandle, int imageIndex, int xHotSpot, int yHotSpot);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_DragEnter(IntPtr hWndLock, int x, int y);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_DragMove(int x, int y);
  [DllImport("comctl32.dll")]
   public static extern bool ImageList_DragLeave(IntPtr hWndLock);
  [DllImport("comctl32.dll")]
   public static extern void ImageList_EndDrag();
  #endregion

  #region Win32 Macro-Like helpers
  public static int GET_X_LPARAM(int lParam)
  {
   return (lParam & 0xffff);
  }
 

  public static int GET_Y_LPARAM(int lParam)
  {
   return (lParam >> 16);
  }

  public static Point GetPointFromLPARAM(int lParam)
  {
   return new Point(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
  }

  public static int LOW_ORDER(int param)
  {
   return (param & 0xffff);
  }

  public static int HIGH_ORDER(int param)
  {
   return (param >> 16);
  }

  #endregion

 }

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多