Skip navigation.

Lolek blog

Everything and nothing...

[c++] always on top source code

, , , ,

Ok, because many people come here searching probably the source code - solution, how to set up window always on top, i'm posting the two lines of the code.. from my app that you can find in previous posts...


Read belowe to find more...

Ok,
to set up the windows always on top you need to use one winapi function: SetWindowPos, with of course, required parameters, and so.
To set it always on top use this:
SetWindowPos(myHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE)

Where:
myHandle - is window HWND - handle to the window we want to set up...
HWND_TOPMOST - place the window in the TOPMOST state...
the zeors are the new size and position of the window (we don't want to change it, but only set it on top)
SWP_NOMOVE - will not move the window
SWP_NOSIZE - will not resize the window after change...
and that's all,
if you want to unset the window just call the function again:
SetWindowPos(myHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

and i think this is all you need to set/unset the window always on top :smile:

If you have any other questions, leave a comment and i'll try to help you if i have some time...

mobile applications, touch screens, motorola, google, google OS and other... borland codegear and gecko browser api

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies