• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Is there a windows api function for this...??

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Bmxpunk86pl

Member
Joined
Sep 7, 2001
Location
CT/Poland
YEa i was wondering if there is a win api function that tells a program to always stay on top of all the other programs running?


Thanks,
adam
 
hey ur a senior now, congrats.

If I wanted to search for it, what would be the key words?


Thanks,
adam
 
i don't know if this is exactly what you are looking for, but if you wanted a window that stayed on top, and didn't let the user click anything else until the window closed, you would want a system modal dialog box/window. or if you wanted a box that didn't let the user click on anything else in the application you want an application modal dialog. I don't remember how to set these though.
 
ok i chilled at a IRC channel for a while and asked this question and some peopel said that I should check out platformsdk ffs, RegisterWindowClass* CreateWindowØ, and SetWindowPos(). Do you guys think that these would do it?

I didnt ask anymore info cuz that was a "special" channel and I didnt wanna sound like a newbie, if you know what I mean so any further help with what is above is greatly appreciated.
 
If the sdk says they will do it, I would believe it. Maybe actually checking the sdk or trying them out would be quicker than waiting for people on a messageboard.
 
Bmxpunk86pl said:
ok i chilled at a IRC channel for a while and asked this question and some peopel said that I should check out platformsdk ffs, RegisterWindowClass* CreateWindowØ, and SetWindowPos(). Do you guys think that these would do it?

I didnt ask anymore info cuz that was a "special" channel and I didnt wanna sound like a newbie, if you know what I mean so any further help with what is above is greatly appreciated.

Yup that's the one, here's the syntax:
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

example (VB):
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public sub SetTopMostWindow(hwnd As Long, Topmost As Boolean)

If Topmost = True Then 'set to be on top
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
0, FLAGS)
Else 'set to be regular
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
0, 0, FLAGS)
End If
End sub
 
Last edited:
Back