ImportWin32.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace ComPDFKit.Tool.Help
  8. {
  9. internal class ImportWin32
  10. {
  11. private const string ImeDll = "imm32.dll";
  12. [StructLayout(LayoutKind.Sequential)]
  13. internal struct RECT
  14. {
  15. public int left;
  16. public int top;
  17. public int right;
  18. public int bottom;
  19. }
  20. [StructLayout(LayoutKind.Sequential)]
  21. internal struct POINT
  22. {
  23. public int x;
  24. public int y;
  25. }
  26. [StructLayout(LayoutKind.Sequential)]
  27. internal struct CompositionForm
  28. {
  29. public int dwStyle;
  30. public POINT ptCurrentPos;
  31. public RECT rcArea;
  32. }
  33. [DllImport(ImeDll)]
  34. internal static extern IntPtr ImmGetContext(IntPtr hWnd);
  35. [DllImport(ImeDll)]
  36. [return: MarshalAs(UnmanagedType.Bool)]
  37. internal static extern bool ImmReleaseContext(IntPtr hWnd, IntPtr hIMC);
  38. [DllImport(ImeDll)]
  39. [return: MarshalAs(UnmanagedType.Bool)]
  40. internal static extern bool ImmSetCompositionWindow(IntPtr hIMC, ref CompositionForm form);
  41. [DllImport(ImeDll)]
  42. internal static extern IntPtr ImmGetDefaultIMEWnd(IntPtr hWnd);
  43. }
  44. }