TRACKMOUSEEVENT.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //#########################################################################################
  2. //★★★★★★★ http://www.cnpopsoft.com [华普软件] ★★★★★★★
  3. //★★★★★★★ 华普软件 - VB & C#.NET 专业论文与源码荟萃! ★★★★★★★
  4. //#########################################################################################
  5. /*
  6. * Copyright ?2005, Mathew Hall
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. *
  12. * - Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. *
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  23. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  24. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  25. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  28. * OF SUCH DAMAGE.
  29. */
  30. using System;
  31. using System.Runtime.InteropServices;
  32. using System.Security.Permissions;
  33. namespace XPTable.Win32
  34. {
  35. /// <summary>
  36. /// The TRACKMOUSEEVENT structure is used by the TrackMouseEvent function
  37. /// to track when the mouse pointer leaves a window or hovers over a window
  38. /// for a specified amount of time
  39. /// </summary>
  40. [StructLayout(LayoutKind.Sequential)]
  41. internal class TRACKMOUSEEVENT
  42. {
  43. /// <summary>
  44. /// Specifies the size of the TRACKMOUSEEVENT structure
  45. /// </summary>
  46. public int cbSize;
  47. /// <summary>
  48. /// Specifies the services requested
  49. /// </summary>
  50. public int dwFlags;
  51. /// <summary>
  52. /// Specifies a handle to the window to track
  53. /// </summary>
  54. public IntPtr hwndTrack;
  55. /// <summary>
  56. /// Specifies the hover time-out in milliseconds
  57. /// </summary>
  58. public int dwHoverTime;
  59. /// <summary>
  60. /// Creates a new TRACKMOUSEEVENT struct with default settings
  61. /// </summary>
  62. public TRACKMOUSEEVENT()
  63. {
  64. // Marshal.SizeOf() uses SecurityAction.LinkDemand to prevent
  65. // it from being called from untrusted code, so make sure we
  66. // have permission to call it
  67. SecurityPermission permission = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
  68. permission.Demand();
  69. this.cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT));
  70. this.dwFlags = 0;
  71. this.hwndTrack = IntPtr.Zero;
  72. this.dwHoverTime = 100;
  73. }
  74. }
  75. }