Results 1 to 3 of 3

Thread: Minimize IDE on Code Run (F5)

Threaded View

  1. #1

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Resolved 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width