Not quite. I knew I would run into more problems. That's why I left the thread open.
I can't get the SetFocus API to work. I think it might be because the program has a system tray icon and it's POSSIBLE that it's counting the icon as it's own form and attempting to set focus to that, but here's what I have:
VB Code:
Declare Function SetFocus Lib "user32.dll" ( _ ByVal hwnd As Int32) As Int32 ... SetFocus(Procs(0).MainWindowHandle.ToInt32)
MainWindowHandle returns an IntPtr... I had to convert it to an Integer to pass it to the API. Not sure what I should do.
Should I jump back to the earlier code about getting all the different handels on the form and set focus to all of them and hopefully one is the actual main window?
EDIT: And just for the record, Procs(0) does have the program attached to it.




Reply With Quote