Graphics window fix

BlitzPlus Forums/BlitzPlus Programming/Graphics window fix

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you've ever wanted to have a Graphics window with a working minimize and close button, heres the fix:

Download bwin.dll

Userlib:
; bwin DLL by Eikon
.lib "bwin.dll"
win_Close%(hWnd%)

.lib "user32.dll"
GetActiveWindow%()
SetWindowLong%(hWnd%,Val%,Long%):"SetWindowLongA"
GetWindowLong%(hWnd%,Val%):"GetWindowLongA"
SetWindowPos%(hWnd%,hAfter%,x%,y%,cx%,cy%,flags%)

B+ Code:
AppTitle "Proper Graphics window by Eikon"
Graphics 640, 480, 16, 2
SetBuffer BackBuffer()

Const GWL_STYLE        = -16
Const WS_MINIMIZE      = $00020000
Const WS_SYSMENU       = $00080000
Const SWP_NOSIZE       = $0001
Const SWP_NOMOVE       = $0002
Const SWP_FRAMECHANGED = $0020

hWnd = GetActiveWindow()              
Style = GetWindowLong(hWnd, GWL_STYLE) 
SetWindowLong hWnd, GWL_STYLE, Style Or WS_MINIMIZE Or WS_SYSMENU
SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_FRAMECHANGED

c_Time = MilliSecs()
Repeat

If MilliSecs() >= c_Time + 100 Then ; Poll the close
	If win_Close(hWnd) Then End
	c_Time = MilliSecs() 
EndIf

Until KeyDown(1)
End

Normally Graphics windows in B+ have no titlebar buttons at all.