this is how i accomplished this, check to see if it works for you:
VB Code:
Declare Function ShowWindow Lib "user32" (ByVal hWnd As Int32, ByVal nCmdShow As Int32) As Int32 Dim proc() As Process proc = Process.GetProcessesByName(Application.ProductName) If proc.Length > 1 Then If proc(1).Id = Process.GetCurrentProcess.Id Then ShowWindow(proc(0).MainWindowHandle.ToInt32, 9) Microsoft.VisualBasic.AppActivate(proc(0).Id) Else ShowWindow(proc(1).MainWindowHandle.ToInt32, 9) Microsoft.VisualBasic.AppActivate(proc(1).Id) End If Exit Sub End If




Reply With Quote