B+ window has a Minimize gadgetArchives Forums/BlitzPlus Programming/B+ window has a Minimize gadget
| 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 :
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)
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)
You must put a text file called Minimize.decls in the userlibs folder of BlitzPlus
and type the following in it :
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"
| Have u also found out a technique adding and checking a "maximise" button in windowed mode?|
I'm searching for a way that when a such a button is clicked, my program will switch to fullscreen mode.
| I Will see what I can do :) |
| Hope you didn't work too long on this Sphinx|
It's been in the Code archives for a while
| Well, mine is different and I think is better as it works directly on the Blitzcc window|
You do not need to add a window gadget and make the code necessary for flipping in full screen mode and the one necessary for Canvas .... if you know what I mean!!
| I've got the minimize button to work, but I'm having no joy with the close button. I am creating my window with the Graphics command. |
| @Matt: If all else fails you can try mine:|
If it works for you I might be able to move it all to userlib and axe the DLL. Let me know.
@Matt: Better idea ;)
| I swapped to CreateWindow rather than Graphics and it all slotted into place. Thanks! |