I have used AppActivate in the past with VB6 Projects and am able to do same successfully in VB.Net.
When using AppActivate I just use AppActivate("My Form Name Here") and a Try/Catch Block
I reading some forums I see that there is a better way to do same in VB.Net using code similar to the following:
Question is - What do I use for lpszParentClass and lpszParentWindow?
I assume lpszParentWindow="My Form Name Here" - that's what I see in Task Manager 'Applications'
Code:ParenthWnd = FindWindow(lpszParentClass, lpszParentWindow) If ParenthWnd.Equals(IntPtr.Zero) Then MsgBox("Program Not Running!") Else ' Found it, so echo that we found it to debug window ' Then set it to foreground MsgBox("Program Found") SetForegroundWindow(ParenthWnd) End If




Reply With Quote