[bb] Minimize/Maximize Buttons by pantsonhead.com [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : Minimize/Maximize Buttons
Author : pantsonhead.com
Posted : 1+ years ago

Description : This code is handy if you have a non-resizable window that you want to minimize.

Note: This will not work if you include a statusbar in the window style.

Requires User32.dll decls
.lib "user32.dll"
GetWindowLong% (hwnd%, nIndex%) : "GetWindowLongA"
SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"


Code :
Code (blitzbasic) Select
Global winMain = CreateWindow("Main Window",100,100,200,200,0,1)

; Here's the magic bit :)
hWND=QueryObject(winMain,1)
x = GetWindowLong(hWnd, -16)
x = x Or $20000   ;WS_MINIMIZEBOX - add Minimize button
;x = x Or $10000   ;WS_MAXIMIZEBOX - add Maximize button
SetWindowLong (hWnd, -16, x)

;Refresh WindowMenu to see new buttons
UpdateWindowMenu winMain

Repeat
If WaitEvent(1) =$803 Then
End
EndIf
Forever


Comments : none...