Mark_FreeSoftware
asked on
SetWindowPos & taskbar?
i'm using this api call to set my app on top of all others, but it is still not ontop of the taskbar.
Const HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "user32" (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)
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
how can i have my program above the windows taskbar?
>>how can i have my program above the windows taskbar?
Dont think you can unless your program is full screen.
-Brian
Dont think you can unless your program is full screen.
-Brian
Hi Mark_FreeSoftware,
this snippet worked for me
--------
Private Declare Function SetWindowPos Lib "user32" (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
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Sub Form_DblClick()
Unload Me
End Sub
Private Sub Form_Load()
SetWindowPos hwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
SetWindowPos hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE
End Sub
--------
i could move my form over all other forms and over the taskbar, then i tried your code and it worked too staying on top over all forms even when not activated not sure if this is windows version related as i'm working on windows 2003 server
where have you placed your code in the form load or not?
hope this helps a bit
bruintje
this snippet worked for me
--------
Private Declare Function SetWindowPos Lib "user32" (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
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Sub Form_DblClick()
Unload Me
End Sub
Private Sub Form_Load()
SetWindowPos hwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
SetWindowPos hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE
End Sub
--------
i could move my form over all other forms and over the taskbar, then i tried your code and it worked too staying on top over all forms even when not activated not sure if this is windows version related as i'm working on windows 2003 server
where have you placed your code in the form load or not?
hope this helps a bit
bruintje
missed that comment, sorry
ASKER
@ BrianGEFF719
that didnt work,
i discovered that the api i use actually works, as long as no other screen of my application has the focus
so whenever i open the options screen, my app suddenly disappears behind the taskbar!
what could be causing this?
that didnt work,
i discovered that the api i use actually works, as long as no other screen of my application has the focus
so whenever i open the options screen, my app suddenly disappears behind the taskbar!
what could be causing this?
Thats because you have the option enabled in windows to keep the taskbar ontop of all windows.
Right click Start button on windows and you will see the option.
Right click Start button on windows and you will see the option.
Right click, choose properties.. my bad
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>Or you could just use the same API again on the newly opened window in your application, just perform the same api call in every form load.
that did it, thanks!
that did it, thanks!
Private Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
dim lngRet as long
lngRet = SetForegroundWindow(me.hwn
Let me know if that works for you.
Brian