netripper

netripper

Dec 26th, 2009
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 KB | None | 0 0
  1. /////// Add this in a new file called NativeMethods.cs, in the public class NativeMethods
  2.         #region ShowWindow
  3.  
  4.         // From: http://www.pinvoke.net/default.aspx/user32.ShowWindow
  5.         [DllImport("coredll.dll")]
  6.         public static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow);
  7.  
  8.         public enum WindowShowStyle : uint
  9.         {
  10.             Hide = 0,
  11.             ShowNormal = 1,
  12.             ShowMinimized = 2,
  13.             ShowMaximized = 3,
  14.             Maximize = 3,
  15.             ShowNormalNoActivate = 4,
  16.             Show = 5,
  17.             Minimize = 6,
  18.             ShowMinNoActivate = 7,
  19.             ShowNoActivate = 8,
  20.             Restore = 9,
  21.             ShowDefault = 10,
  22.             ForceMinimized = 11
  23.         }
  24.  
  25.         #endregion
  26.  
  27. /////// Add this member variable to the Form
  28.         private System.Windows.Forms.Timer showWindowTimer;
  29.  
  30. /////// Add this to the constructor
  31.             showWindowTimer = new System.Windows.Forms.Timer();
  32.             showWindowTimer.Enabled = false;
  33.             showWindowTimer.Interval = 250;
  34.             showWindowTimer.Tick += new EventHandler(showWindowTimer_Tick);
  35.  
  36. /////// Add this method to the form class
  37.         void showWindowTimer_Tick(object sender, EventArgs e)
  38.         {
  39.             NativeMethods.ShowWindow(this.Handle, NativeMethods.WindowShowStyle.Show);
  40.         }
  41.  
  42. /////// Add this line to the bottom of MakeVisible()
  43.             showWindowTimer.Enabled = true;
  44.  
  45.  
  46. /////// Add this line to the top of Dismiss()
  47.             showWindowTimer.Enabled = false;
  48.  
Add Comment
Please, Sign In to add comment