Making the window borderless..

Blitz3D Forums/Blitz3D Programming/Making the window borderless..

poopla(Posted 2004) [#1]
I have a DLL that's grabbing the blitz windows handle. I tried using SetWindowLong() to set a new style, but no matter what I do it seems to not like me messing with it. How have others managed this?


Binary_Moon(Posted 2004) [#2]
I have a DLL that's grabbing the blitz windows handle.


You don't need a dll to get the hwnd

hwnd = User32_FindWindow( "Blitz Runtime Class", "AppTitle here" )


To change the style you need the following constants

; Set Window Long 
Const GWL_WNDPROC		=(-4)
Const GWL_HINSTANCE		=(-6)
Const GWL_HWNDPARENT	=(-8)
Const GWL_STYLE			=(-16)
Const GWL_EXSTYLE		=(-20)
Const GWL_USERDATA		=(-21)
Const GWL_ID			=(-12)

; Window Style
Const WS_OVERLAPPED		=$0
Const WS_POPUP			=$80000000
Const WS_CHILD			=$40000000
Const WS_MINIMIZE		=$20000000
Const WS_VISIBLE		=$10000000
Const WS_DISABLED		=$8000000
Const WS_CLIPSIBLINGS	=$4000000
Const WS_CLIPCHILDREN	=$2000000
Const WS_MAXIMIZE		=$1000000
Const WS_CAPTION		=$C00000
Const WS_BORDER			=$800000
Const WS_DLGFRAME		=$400000
Const WS_VSCROLL		=$200000
Const WS_HSCROLL		=$100000
Const WS_SYSMENU		=$80000
Const WS_THICKFRAME		=$40000
Const WS_GROUP			=$20000
Const WS_TABSTOP		=$10000
Const WS_MINIMIZEBOX	=$20000
Const WS_MAXIMIZEBOX	=$10000
Const WS_TILED			=WS_OVERLAPPED
Const WS_ICONIC			=WS_MINIMIZE
Const WS_SIZEBOX		=WS_THICKFRAME
Const WS_OVERLAPPEDWINDOW=(WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
Const WS_TILEDWINDOW	=WS_OVERLAPPEDWINDOW
Const WS_POPUPWINDOW	=(WS_POPUP Or WS_BORDER Or WS_SYSMENU)
Const WS_CHILDWINDOW	=(WS_CHILD)


and then just use

User32_SetWindowLong(hwnd,GWL_STYLE,style)


Note that the styles can be combined. The splash screen in ExGen uses WS_VISIBLE + WS_BORDER and is a borderless title bar less window.

You need to make the window update by repositioning or moving it or something; I use

User32_MoveWindow(hwnd,x,y,w,h,True)


The userlibs needed are

.lib "user32.dll"

User32_FindWindow%( class$,Text$ ):"FindWindowA"
User32_SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
User32_MoveWindow% (hwnd%, x%, y%, nWidth%, nHeight%, bRepaint%) : "MoveWindow"



Perturbatio(Posted 2004) [#3]
I managed to remove the title bar.
(see http://www.blitzbasic.com/Community/posts.php?topic=33294#361064 )

but I couldn't figure out how to get it to refresh


poopla(Posted 2004) [#4]
Correction, I should have stated I have a userlib grabbing the hwnd ;).


Robert(Posted 2004) [#5]
but I couldn't figure out how to get it to refresh


You need to call SetWindowPos subsequently with the SWP_FRAMECHANGED flag.