• Creator
    Topic
  • #4295
    RPP
    Participant

      Hi

      I have created an ActiveX EXE in VB and I use Formativ to make calls to the various procedures and methods I have exposed in my class.

      The app’s methods are called from buttons added to the email toolbar.

      What I have found is that once the ActiveX call has completed my Groupwise email’s window goes behind any non-Groupwise window that may have been open.

      It’s tricky to recreate but basically if I am looking at a windows explorer window then click onto a GW email to bring it to the surface, then click the button that triggers my applet (which calls the ActiveX EXE) and then cancel the app’s form I will see my GW email go behind the windows explorer. Strangely the GW email will never go behind another GW Email or the Main GW window.

      I have tried adding BringWindowToTop to my VB app just before the ActiveX method exits but GW seems to ignore it.

      I also tried setting the GW window topmost at the beginning of my method and then releasing it from topmost state at the end. This works in that the GW email stays on the surface but it doesn’t then have focus. Explorer does.

      As far as I can see the ActiveX call itself can’t do the job. As soon as it completes the GW email loses focus.

      Is it possible to make Windows API calls direct from Formativ. I suspect I could use the SetWindowPos (topmost) and SetActiveWindow to fix my problem.

      Thanks

      Simon

    • Author
      Replies
    • #7754
      RPP
      Participant

        Further to my previous message I have found a solution of sorts. At least I think so.

        Basically my ActiveX sets and release TopMost as described before – then I use a DoEvents and a SetForegroundWindow in the Formativ applet just before it exits.

        This keeps the window on-top and focused.

        I’ll still prefer to make the API calls from Formativ as it would be cleaner. Is that possible?

        Thanks

        Simon

        #7755
        Support 3
        Participant

          You cannot run any Windows API calls directly from Formativ/VBScript. You have to create your own component/wrapper that will serve as a proxy between your script and the APIs. However, Formativ has exposed some common Windows APIs (i.e. FindWindow, SetForegroundWindow). See the Formativ Language Guide for more details.

          In the meantime, you can find the handle of the message window then set as foreground window. You can also set the focus to a specified control of the message window. Here is an example:

            
            iHandle = Utilities.FindWindow("OFMailView","")
            if (iHandle > 0) then
              utilities.SetForegroundWindow(iHandle)
              utilities.doevents
          
              ' Gives the input focus to a specified Windows control.
              call groupwise.FocusSet(fcsMessage, "")
            end if
          

          Hope this helps.

          Regards,
          Advansys Support

        Viewing 2 replies - 1 through 2 (of 2 total)
        • You must be logged in to reply to this topic.