Code archives/BlitzPlus Gui/B+ window has a Minimize gadget

This code has been declared by its author to be Public Domain code.

Download source code

B+ window has a Minimize gadget by Sphinx2004
Hi all

Here is the code I wanted to share with you which will show the minimize and close
gadgets for the blitz+ window. Also you can download the source and lib file here :

http://www.ancientsoft.com/downloads/MyWindowed.zip


You must put a text file called Minimize.decls in the userlibs folder of BlitzPlus
and type the following in it :

.lib "user32.dll"
GetWindowLong% (hwnd%, nIndex%) : "GetWindowLongA"
SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
FindWindow% (NullString, WindowText$) : "FindWindowA"
SetWindowText% (hwnd%, lpString$) : "SetWindowTextA"
SetWindowPos% (hwnd%, hWndInsertAfter%, x% ,y% , cx%, cy%, wFlags% ) : "SetWindowPos"
ShowWindow% (hwnd%, nCmdShow%): "ShowWindow"
Const GWL_STYLE = -16		; Retrieve the window styles of the window
Const WS_SYSMENU = 13107200 	; &H80000 = The window has a system menu on its title bar
Const WS_MINIMIZEBOX = 131072	; &H20000 = The window has a minimize button (The WS_SYSMENU window style must also be specified)


Graphics 640,480,16,2

	hWND=FindWindow("","blitzcc") 				;Get the handle of the BlitzCC window (You should change that to the AppTitle you specified if you did)
	WLong = GetWindowLong(hWND, GWL_STYLE) 			;Now get the attribute/style of this window
	WLong = WLong Or WS_SYSMENU Or WS_MINIMIZEBOX		;(Or-ing to add attribute/style if it is not applied)
	SetWindowLong (hWND, GWL_STYLE, WLong)			;Change the attribute/style of the BlitzCC window to show the minimize button
	SetWindowText (hWnd,"My B+ window can be minimized :)") ;Now change the title to whatever you like
	ShowWindow(hWND,0) : ShowWindow(hWND,1) 		;make sure the changes will take effect

While Not KeyHit(1)
Wend

Comments

4pac2004
Basicly I like this idea, but when working with B+, why do you work in the graphics mode? I´m looking for this function for a GUI based appilcation I wrote in B+, that´s why I´m asking ;-)

Regards,
Thomas


Sphinx2004
Here is another function for your GUI based application :

http://www.blitzbasic.com/codearcs/codearcs.php?code=897


Code Archives Forum