December 03, 2020, 07:16:29 PM

Author Topic: [bb] Disable window Close button by Perturbatio [ 1+ years ago ]  (Read 440 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Disable window Close button
Author : Perturbatio
Posted : 1+ years ago

Description : Requires the winapi decls for User32:

api_GetSystemMenu%(hWnd , bRevert):"GetSystemMenu"
api_DeleteMenu%(hMenuHandle, SC_CLOSE, MF_BYCOMMAND):"DeleteMenu"


Code :
Code: BlitzBasic
  1. AppTitle "testclose"
  2. Graphics 640,480,32,2
  3. SetBuffer BackBuffer()
  4.  
  5. Global hwndHandle%
  6. Global hMenuHandle%
  7. Const SC_CLOSE% = 61536
  8. Const MF_BYCOMMAND% = 0
  9.  
  10. hwndHandle= api_FindWindow("Blitz Runtime Class", "testclose")
  11.  
  12. If hwndHandle<> 0 Then
  13.  
  14.         hMenuHandle= api_GetSystemMenu(hwndHandle, False);
  15.        
  16.         If hMenuHandle<> 0 Then
  17.                 api_DeleteMenu(hMenuHandle, SC_CLOSE, MF_BYCOMMAND)    
  18.         EndIf
  19.  
  20. EndIf
  21.  
  22.  
  23. While Not KeyDown(1)
  24.         Print hwndHandle
  25.         Print hMenuHandle
  26.         Flip
  27.         Cls
  28. Wend
  29. End


Comments :


jfk EO-11110(Posted 1+ years ago)

 great, and no dll required! thanks!


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal