Window close button

BlitzMax Forums/BlitzMax Beginners Area/Window close button

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.

My apologies guys, I thought you meant Minimize, now I know you mean CLOSE (duh!)

Try this. Stop with the IDE stop button. Don't know how safe this is though :)

hwnd=CreateWindowExA(0,ClassName(),"Hello World".ToCString(),WS_CAPTION|WS_VISIBLE, ..
0,100,640,480,0,0,GetModuleHandleA(Null),Null)

While Not KeyDown(KEY_ESCAPE)
Wend
End


Function ClassWndProc(hwnd,msg,wp,lp) "win32"
	Return DefWindowProcA( hwnd,msg,wp,lp )
End Function

Function ClassName:Byte Ptr()
	Global _name:Byte Ptr
	Global _wc:WNDCLASS
	Global _icon
	
	If _name=Null
		_name="BLITZMAX_WINDOW_CLASS".toCString()
		_icon=LoadIconA(GetModuleHandleA(Null),Byte Ptr(101))
		_wc=New WNDCLASS
		_wc.style=CS_OWNDC|CS_HREDRAW|CS_VREDRAW
		_wc.lpfnWndProc=ClassWndProc
		_wc.hInstance=GetModuleHandleA(Null)
		_wc.hIcon=_icon
		_wc.hCursor=LoadCursorA( 0,Byte Ptr( IDC_ARROW ) )
		_wc.hbrBackground=COLOR_BTNFACE+1
		_wc.lpszMenuName=Null
		_wc.lpszClassName=_name		
		RegisterClassA(_wc)
	EndIf
	Return _name
End Function

I pinched the 2 functions from skidracer's axe module.
BlitzMax CreateGraphics function uses WS_CAPTION|WS_VISIBLE|WS_SYSMENU style. If you're game, you can modify the d3d7graphics.bmx source and remove the WS_SYSMENU from Function CreateHWND