Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    L.A., California
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Activate VB app from IE (VB6)

    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
    <pre>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
    </pre>

    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
    <pre>lRet = SendMessage(frmMain.hWnd, WM_ACTIVATE, 0&, 0&)
    </pre>

    I also tried the WM_ACTIVATEAPP message. Neither worked. This should be doable, anybody know how?
    Thanks...

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Activate VB app from IE (VB6)

    Would it be cheating to minimize or "blur" the browser window? (Actually, I don't know enough about ActiveX controls running in browsers to know whether you can do that.)

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    L.A., California
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate VB app from IE (VB6)

    I'm not sure what you mean by "blur" the window. I'm guessing making the title bar grey? If so, this should happen automatically if the VB app gets the active focus like I want. Minimizing the window might be ok, but I'm not sure that would solve the problem, as an app can be minimized and still be active, I think. In any case, I really do need to activate the VB app. I've tried many variations of sendmessage, no luck....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •