NativeMethods.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace S7.Net.UnitTest.Helpers
  4. {
  5. internal static class NativeMethods
  6. {
  7. [StructLayout(LayoutKind.Sequential)]
  8. public struct CURSORINFO
  9. {
  10. public Int32 cbSize;
  11. public Int32 flags;
  12. public IntPtr hCursor;
  13. public POINTAPI ptScreenPos;
  14. }
  15. [StructLayout(LayoutKind.Sequential)]
  16. public struct POINTAPI
  17. {
  18. public int x;
  19. public int y;
  20. }
  21. [DllImport("user32.dll")]
  22. public static extern int BringWindowToTop(IntPtr hwnd);
  23. [DllImport("kernel32.dll")]
  24. public static extern bool AllocConsole();
  25. [DllImport("kernel32.dll")]
  26. public static extern bool FreeConsole();
  27. [DllImport("kernel32.dll")]
  28. public static extern IntPtr GetConsoleWindow();
  29. [DllImport("kernel32.dll")]
  30. public static extern int GetConsoleOutputCP();
  31. [DllImport("user32.dll")]
  32. public static extern bool GetCursorInfo(out CURSORINFO pci);
  33. [DllImport("user32.dll")]
  34. public static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);
  35. }
  36. }