NativeMethods.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:NativeMethods.cs
  5. * 2.功能描述:类文件
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/09/01 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Diagnostics.CodeAnalysis;
  12. using System.Drawing;
  13. using System.Runtime.InteropServices;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel.Win32;
  15. namespace Dongke.IBOSS.PRD.Basics.DockPanel
  16. {
  17. internal static class NativeMethods
  18. {
  19. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  20. [return: MarshalAs(UnmanagedType.Bool)]
  21. public static extern bool DragDetect(IntPtr hWnd, Point pt);
  22. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  23. public static extern IntPtr GetFocus();
  24. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  25. public static extern IntPtr SetFocus(IntPtr hWnd);
  26. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  27. [return: MarshalAs(UnmanagedType.Bool)]
  28. public static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
  29. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  30. public static extern uint SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
  31. [DllImport("User32.dll", CharSet = CharSet.Auto)]
  32. public static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, int X, int Y, int Width, int Height, FlagsSetWindowPos flags);
  33. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  34. public static extern int GetWindowLong(IntPtr hWnd, int Index);
  35. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  36. public static extern int SetWindowLong(IntPtr hWnd, int Index, int Value);
  37. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  38. public static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
  39. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  40. //*********************************
  41. // FxCop bug, suppress the message
  42. //*********************************
  43. [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", MessageId = "0")]
  44. public static extern IntPtr WindowFromPoint(Point point);
  45. [DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
  46. public static extern int GetCurrentThreadId();
  47. public delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
  48. [DllImport("user32.dll")]
  49. public static extern IntPtr SetWindowsHookEx(Win32.HookType code, HookProc func, IntPtr hInstance, int threadID);
  50. [DllImport("user32.dll")]
  51. public static extern int UnhookWindowsHookEx(IntPtr hhook);
  52. [DllImport("user32.dll")]
  53. public static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wParam, IntPtr lParam);
  54. }
  55. }