Hi All,
I need to activate a running VB app as a result of clicking on some control in a browser based app in IE. In addition, a particular form needs to be opened & populated with values. Here’s what I’ve accomplished so far:
Using an ActivexEXE as a “broker”, I’ve gotten the browser app to execute a method in a class in the ActivexEXE, which then causes an event to be raised. My VB app declared the ActivexEXE’s class WithEvents, so the event gets handled, and the form is opened properly. Of course, the app was underneath the browser, so I had to figure out how to put it on top. I got this with
SendWindowPos frmMain.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE SendWindowPos frmMain.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE SetActiveWindow frmMain.hWnd
Unfortunately, even though the VB app is on top, the browser window below it still has the blue title bar. As expected, the taskbar button for the VB app blinks several times, telling me it’s active, although its title bar is grey. Also, I can’t click on the browser window and use it without first clicking on either the VB app or its taskbar button to activate it.
So…the problem is, now that I’ve gotten it on top, how do I actually activate the VB app? I’ve tried every combination of the SetFocus, SetForegroundWindow & SetActiveWindow APIs with no luck. I’ve also tried a VB SetFocus to a control on the new form, all to no avail.
Assuming that clicking the taskbar button actually sends a message to the proper window to activate, I also tried doing a
lRet = SendMessage(frmMain.hWnd, WM_ACTIVATE, 0&, 0&)
I also tried the WM_ACTIVATEAPP message. Neither worked. This should be doable, anybody know how?
Thanks…