Hello! I have a small program I wrote to open a program, close, then reopen itself when the program is closed.
It works perfectly, but when the program reopens, it opens in this weird state where it appears in the taskbar, but will not show on the screen unless I right click on it and click maximize. The weird thing is that it works perfectly with another program. Anyone have any idea what's wrong?Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Used to Open/View passwords Process.Start("E:\Programs\KeePass\KeePass1.exe") System.Threading.Thread.Sleep(1000) Dim myProcesses() As Process myProcesses = Process.GetProcessesByName("KeePass1") If myProcesses.Count > 0 Then Me.WindowState = FormWindowState.Minimized Me.Visible = False End If Do Until Me.WindowState = FormWindowState.Normal Dim myProcesses2() As Process myProcesses2 = Process.GetProcessesByName("KeePass1") If myProcesses2.Count = 0 Then Me.WindowState = FormWindowState.Normal Me.Visible = True End If Loop End Sub




Reply With Quote
