Home » VB.NetRSS

[VS 2010 - VB] Minimize IDE on F5 - Run

Is there an option in VS 2010 Pro (VB installed only) to have the IDE minimize when I press F5 to test run my code?
 

2 Answers Found

 

Answer 1

 

I dont think that there is any option, but you can put it in your code  like this

This minimize  the IDE when start to run  the application and retore it when it you close it

PublicClass Form1

 PrivateSub Form1_FormClosing(ByVal sender AsObject, ByVal e As System.Windows.Forms.FormClosingEventArgs) HandlesMe.FormClosing
#If DEBUG ThenDim Pr() As Process = Process.GetProcesses
  ForEach P As Process In Pr
   If P.MainWindowTitle.Contains(My.Application.Info.AssemblyName) ThenDim hwnd As IntPtr = P.MainWindowHandle
    ShowWindow(hwnd, 9)
    ExitForEndIfNext#End IfEndSubPrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
#If DEBUG ThenDim Pr() As Process = Process.GetProcesses
  ForEach P As Process In Pr
   If P.MainWindowTitle.Contains(My.Application.Info.AssemblyName) ThenDim hwnd As IntPtr = P.MainWindowHandle
    ShowWindow(hwnd, 6)
    ExitForEndIfNext#End IfEndSubDeclareFunction ShowWindow Lib"User32.dll" (ByVal hwnd As IntPtr, ByVal nCmdShow AsUInteger) AsBooleanEndClass
 

Answer 2

Good old ShowWindow, never even thought of that,... though even if I had I'd be puzzled how to pull it off in .Net (classic vb in my blood).

Thanks!

 

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter