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.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”