• Activate VB app from IE (VB6)

    Author
    Topic
    #410476

    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…

    Viewing 1 reply thread
    Author
    Replies
    • #882674

      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.)

      • #882895

        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….

      • #882896

        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….

    • #882675

      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.)

    Viewing 1 reply thread
    Reply To: Activate VB app from IE (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: