Bringing an Application to the Front in XP

This is a discussion on Bringing an Application to the Front in XP within the Windows Programming forums, part of the Platform Specific Boards category; Hi there, How do I code to bring an application to front of all other applications and give it focus? ...

  1. #1
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812

    Bringing an Application to the Front in XP

    Hi there,

    How do I code to bring an application to front of all other applications and give it focus? Sounds simple, but here's the problem:

    What is happening is that the app is not being brought to the front, but its toolbar flashes to indicate to the user that it 'wants' to come to the front. Many standard applications seem to behave this way. I don't recall this being an issue in older versions of windows.

    Anyone know how can override this to force the app to the front?
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  2. #2
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Found this, if anyone's interested.

    http://www.elists.org/pipermail/delp...ne/020556.html

    Basically it explains why the beviour has changed. Therefore, I've decided I don't need to know how to 'force' a window to the front anymore.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Just use mouse_eventf(). That's how I do it.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    what about:

    BringWindowToTop(HWND hMyWindow);
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  5. #5
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    No, that still doesn't work adequately, in Windows XP at least. Remember that XP prevents this happening. Currently, my solution is the only one I know of to make a window the active one. It actually simulates the mouse click at the driver level, so is basically the same as clicking on the window.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  6. #6
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    I see, interesting. I might do some experiments on this.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to Install XP over Vista with SATA HD
    By Shamino in forum Tech Board
    Replies: 2
    Last Post: 12-13-2008, 06:56 PM
  2. Cleanup of the application...
    By Petike in forum Windows Programming
    Replies: 1
    Last Post: 08-16-2008, 06:23 PM
  3. Need help with program
    By HAssan in forum C Programming
    Replies: 8
    Last Post: 06-10-2007, 09:05 PM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  5. Direct Connect between XP and DOS
    By lightatdawn in forum Tech Board
    Replies: 0
    Last Post: 01-22-2004, 11:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21