Library tutorials & articles

API Programming Series #3 - Bring a Window to Top

Analysis

Let us see how this works.

The API function BringWindowToTop accepts the hwnd (Handle to the Window, a unique id that all windows have) of the window that is to be brought on top. It brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated.

While adequate for the purpose of explaining the function, the above example is rather trivial in nature. I.e. it doesn't achieve anything practical. So what would be a practical application for this? Hmmm... Say, you've got a long process running in a window. Naturally you can expect your users to switch to other windows during this period. However, once the process is complete you may want to put this window on top. In such a case this code can be put to use.

Comments

  1. 31 Mar 2003 at 02:27

    Are you using IE?

  2. 25 Feb 2003 at 19:44

    Using VB6 in Windows 2000 this function brings my window to the top of other application windows, but will not bring it above a browser window.  Any suggestions?

  3. 10 Jan 2003 at 08:01
    i've always used "form1.setfocus"....and most times, it just blinked the app in the taskbar...
  4. 01 Jan 1999 at 00:00

    This thread is for discussions of API Programming Series #3 - Bring a Window to Top.

Leave a comment

Sign in or Join us (it's free).

Sreejath S. Warrier

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

We'd love to hear what you think! Submit ideas or give us feedback