AlwaysOnTop and StatusBars

BlitzPlus Forums/BlitzPlus Programming/AlwaysOnTop and StatusBars

Sauer(Posted 2009) [#1]
I found this code in a 5 year old post:
; Always On top - example
; Syntax Error

; userlibs
; ***********************************
; .lib "user32.dll
; SetWindowPos%(hWnd%,hWndAfter%,x%,y%,w%,h%,flags%):"SetWindowPos"
; ***********************************

Global title$="Always On Top"
AppTitle title$
win = CreateWindow(title$,200,100,200,100,Desktop(),3)
;checkbox=CreateButton("Keep me on top of other windows",10,20,200,28,win,2)
;SetButtonState checkbox,True

AlwaysOnTop win

; --------------------------

Repeat
	ev=WaitEvent()
	;If ev=$401
		AlwaysOnTop win , ButtonState(checkbox)
	;EndIf 
Until ev=$803
End

; --------------------------

; set/clear the 'AlwaysOnTop' state of a BlitzPlus window
Function AlwaysOnTop(bpwin,flag=True)
	api_SetWindowPos QueryObject(bpwin,1) , -2+flag ,0,0,0,0 , 83
End Function


What I've found is that it doesn't work when a status bar is added to the window.

Any ideas on how do do this with a status bar? I've been trying different API calls all night...

Thanks,


Sauer(Posted 2009) [#2]
No takers?

Perhaps I need to replace my status bar with a text area?


David Boudreau(Posted 2009) [#3]
Hm well I can at least confirm what you say, that adding a status bar to the window causes it to not work, but generally works otherwise. You might get some help if you post about it in the Win32 forum.

On the winapi page http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx (if I've got that right) there are mentioned a number of flags particularly SWP_NOREDRAW. Also it mentions this for the return value "If the function fails, the return value is zero. To get extended error information, call GetLastError. " but I doubt the function is "failing".


Sauer(Posted 2009) [#4]
Yeah, maybe I should have posted in Win32... but actually, I've done away with the status bar and even the text area... I couldn't get them updating right.

I'm even having the same problem with my other text area... it doesn't seem to be updating to speed. I actually considering going back to a console based app!


Sauer(Posted 2009) [#5]
Yeah I realized that although it works in the IDE it won't work in compiled .exe format.

The program is so warped as it is that I'm just going to tear down and rebuild... the rule is that usually your first attempt isn't worth keeping anyway...