Public feed #377598

Untitled

public text v1 · immutable
Raw Edit
·published 2007-03-01 21:34 UTC
rendered paste body
using System;
using System.Runtime.InteropServices;

namespace SnapForms
{
	public class Win32
	{
          public const int   WM_MOVING            = 0x0216;
          public const int   SnapMargin           = 10;

          [DllImport("user32.dll")]
          public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

          [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
          public static extern bool SetWindowPos(
               int hWnd,               // window handle
               int hWndInsertAfter,    // placement-order handle
               int X,                  // horizontal position
               int Y,                  // vertical position
               int cx,                 // width
               int cy,                 // height
               uint uFlags);           // window positioning flags
          public const int  HWND_TOP       = 0;
          public const int  HWND_BOTTOM    = 0x1;
          public const uint SWP_NOSIZE     = 0x1;
          public const uint SWP_NOMOVE     = 0x2;
          public const uint SWP_SHOWWINDOW = 0x40;

          public const int SW_HIDE             = 0;
          public const int SW_SHOWNORMAL       = 1;
          public const int SW_NORMAL           = 1;
          public const int SW_SHOWMINIMIZED    = 2;
          public const int SW_SHOWMAXIMIZED    = 3;
          public const int SW_MAXIMIZE         = 3;
          public const int SW_SHOWNOACTIVATE   = 4;
          public const int SW_SHOW             = 5;
          public const int SW_MINIMIZE         = 6;
          public const int SW_SHOWMINNOACTIVE  = 7;
          public const int SW_SHOWNA           = 8;
          public const int SW_RESTORE          = 9;
          public const int SW_SHOWDEFAULT      = 10;
          public const int SW_FORCEMINIMIZE    = 11;
          public const int SW_MAX              = 12;
		/// <summary>
		/// Animates the window from left to right. This flag can be used with roll or slide animation.
		/// </summary>
		public const int AW_HOR_POSITIVE = 0X1;
		/// <summary>
		/// Animates the window from right to left. This flag can be used with roll or slide animation.
		/// </summary>
		public const int AW_HOR_NEGATIVE = 0X2;
		/// <summary>
		/// Animates the window from top to bottom. This flag can be used with roll or slide animation.
		/// </summary>
		public const int AW_VER_POSITIVE = 0X4;
		/// <summary>
		/// Animates the window from bottom to top. This flag can be used with roll or slide animation.
		/// </summary>
		public const int AW_VER_NEGATIVE = 0X8;
		/// <summary>
		/// Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
		/// </summary>
		public const int AW_CENTER = 0X10;
		/// <summary>
		/// Hides the window. By default, the window is shown.
		/// </summary>
		public const int AW_HIDE = 0X10000;
		/// <summary>
		/// Activates the window.
		/// </summary>
		public const int AW_ACTIVATE = 0X20000;
		/// <summary>
		/// Uses slide animation. By default, roll animation is used.
		/// </summary>
		public const int AW_SLIDE = 0X40000; 
		/// <summary>
		/// Uses a fade effect. This flag can be used only if hwnd is a top-level window.
		/// </summary>
		public const int AW_BLEND = 0X80000;

		/// <summary>
		/// Animates a window.
		/// </summary>
		[DllImport("user32.dll", CharSet=CharSet.Auto)]
		public static  extern int AnimateWindow(IntPtr hwand , int dwTime , int dwFlags) ;		
	}
}