|
-
Aug 15th, 2010, 06:18 PM
#1
Minimize IDE on Code Run (F5)
Code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
#If DEBUG Then
Dim Pr() As Process = Process.GetProcesses
For Each P As Process In Pr
If P.MainWindowTitle.Contains(My.Application.Info.AssemblyName) Then
Dim hwnd As IntPtr = P.MainWindowHandle
ShowWindow(hwnd, 9)
Exit For
End If
Next
#End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
#If DEBUG Then
Dim Pr() As Process = Process.GetProcesses
For Each P As Process In Pr
If P.MainWindowTitle.Contains(My.Application.Info.AssemblyName) Then
Dim hwnd As IntPtr = P.MainWindowHandle
ShowWindow(hwnd, 6)
Exit For
End If
Next
#End If
End Sub
Declare Function ShowWindow Lib "User32.dll" (ByVal hwnd As IntPtr, ByVal nCmdShow As UInteger) As Boolean
End Class
Thought I'd share this here in case anyone else needed it or knows a better way to minimize the IDE when you run code, since there doesn't seem to be an option (in VS 2010/VB) to do this.
Originally asked on MSDN here.
Last edited by Edgemeal; Aug 15th, 2010 at 06:33 PM.
-
Nov 28th, 2010, 07:06 PM
#2
Re: Minimize IDE on Code Run (F5)
I was looking for this and found this also
1. Please open Macro IDE by menu Tools / Macro / Macro IDE.
2. In MyMacros project, open EnvironmentEvents file
3. Add following code:
Code:
Private Sub DebuggerEvents_OnEnterDesignMode(ByVal Reason As EnvDTE.dbgEventReason) Handles DebuggerEvents.OnEnterDesignMode
DTE.MainWindow.WindowState = vsWindowState.vsWindowStateMaximize
End Sub
Private Sub DebuggerEvents_OnEnterRunMode(ByVal Reason As EnvDTE.dbgEventReason) Handles DebuggerEvents.OnEnterRunMode
DTE.MainWindow.WindowState = vsWindowState.vsWindowStateMinimize
End Sub
-
Nov 29th, 2010, 06:43 PM
#3
Re: Minimize IDE on Code Run (F5)
You may want to modify the OnEnterRunMode method to not minimize when you're stepping through. A simple If statement can handle that.
Code:
If Reason = dbgEventReason.dbgEventReasonGo Then
DTE.MainWindow.WindowState = vsWindowState.vsWindowStateMinimize
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|