December 03, 2020, 08:05:32 PM

Author Topic: [bb] Minimize/Maximize Buttons by pantsonhead.com [ 1+ years ago ]  (Read 495 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
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
Code: [Select]
.lib "user32.dll"
GetWindowLong% (hwnd%, nIndex%) : "GetWindowLongA"
SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"


Code :
Code: BlitzBasic
  1. Global winMain = CreateWindow("Main Window",100,100,200,200,0,1)
  2.  
  3. ; Here's the magic bit :)
  4. hWND=QueryObject(winMain,1)
  5. x = GetWindowLong(hWnd, -16)
  6. x = x Or $20000   ;WS_MINIMIZEBOX - add Minimize button
  7. ;x = x Or $10000   ;WS_MAXIMIZEBOX - add Maximize button
  8. SetWindowLong (hWnd, -16, x)
  9.  
  10. ;Refresh WindowMenu to see new buttons
  11. UpdateWindowMenu winMain
  12.  
  13. Repeat
  14.         If WaitEvent(1) =$803 Then
  15.                 End
  16.         EndIf
  17. Forever


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal