Jump to content
Tuts 4 You

keep the window on top


Recommended Posts


I'm coding on some win32 c++ app. What API should I use to keep the window on top of other windows regardless if it is selected or not?

I'm just guessing it is an API, but I'm not sure if it is one. :confused:

Link to comment

Hi here is a masm example

invoke IsDlgButtonChecked,hWnd,IDC_ALWAYSONTOP

.if eax==BST_CHECKED





invoke SetWindowPos,hWnd,eax,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE

I think this is not difficult to translate in c++


Link to comment

Use SetWindowLong (Ptr if you want it to support x64) or just SetWindowPos()

get the Window handle (hWnd) and use SetWindowPos on it, with IDC_ALWAYSONTOP or WS_EX_TOPMOST :) .

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...