Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Programatically put OI in the foreground

Hi,

how can I programmatically from OI move the OI gui to the foreground? We have a background process that needs to move OI into the foreground when a certain event occurs.

I tried the ACTIVATED event, but it didn't do anything.

Comments

  • Create a pointer to the SetForegroundWindow API function and use the HANDLE property of your OI window to pass in.
  • Thanks

    i will try that
  • it didn't work. it just flashes the oi icon in the task bar. I may be passing the wrong window handle though. I am passing the window handle of the main form (which contains the mdi frame).
  • According to the documentation of SetForegroundWindow:

    An application cannot force a window to the foreground while the user is working with another window. Instead, Windows flashes the taskbar button of the window to notify the user.
  • A dialog window or message box would prevent SetForegroundWindow from working.
  • the actual problem is that an internet explorer widow is appearing over the top of OI, and the users hate having to move it out of the way.

    A simpler solution would just be to make that IE window not appear at all, which i will be able to do soon..

    but i was hoping there would be a way to fix it now.
  • If you look at the documentation Remarks, you'll see a bullet pointed list of conditions where SetForegroundWindow will work. I suspect that the IE window becomes the foreground process, and since that process is not a child process of OI, then the call fails.
  • I see.

    Anyway, maybe I can kill the IE process. I will look into that
Sign In or Register to comment.