WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Windows UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF - HideShow MinMax buttons


#DefineFunction RemoveMaxMinButtons(datitle)
;'Hides the upper right keys Maximize and minimize
;Public Sub RemoveMaxMinButtons(hWnd As Long)
;Dim x As Long
;
;x = GetWindowLong(hWnd, GWL_STYLE)
;x = x And Not WS_MINIMIZEBOX
;x = x And Not WS_MAXIMIZEBOX
;SetWindowLong hWnd, GWL_STYLE, x
;End Sub

WS_MINIMIZEBOX=131072   ;      0x00020000L
WS_MAXIMIZEBOX=65536    ;      0x00010000L
GWL_STYLE= -16          ;           (-16)

dll=strcat(DirWindows(1),"user32.dll")
hwnd=DllHwnd(DaTitle)
x=DllCall(dll,long:"GetWindowLongA",long:hwnd,long:GWL_STYLE)
x= x & (~WS_MINIMIZEBOX)   ; ~ is a tilde, not a - 
x= x & (~WS_MAXIMIZEBOX)    ; ~ is a tilde, not a - 
DllCall(dll,long:"SetWindowLongA",long:hwnd,long:GWL_STYLE,long:x)



#EndFunction

#DefineFunction AddMaxMinButtons(datitle)

;
;'Shows the upper right keys Maximize and minimize
;Public Sub AddMaxMinButtons(hWnd As Long)
;Dim x As Long
;
;x = GetWindowLong(hWnd, GWL_STYLE)
;x = x Or WS_MINIMIZEBOX
;x = x Or WS_MAXIMIZEBOX
;SetWindowLong hWnd, GWL_STYLE, x
;End Sub
WS_MINIMIZEBOX=131072   ;      0x00020000L
WS_MAXIMIZEBOX=65536    ;      0x00010000L
GWL_STYLE= -16          ;           (-16)

dll=strcat(DirWindows(1),"user32.dll")
hwnd=DllHwnd(DaTitle)
x=DllCall(dll,long:"GetWindowLongA",long:hwnd,long:GWL_STYLE)
x= x  | WS_MINIMIZEBOX    
x= x  | WS_MAXIMIZEBOX     
DllCall(dll,long:"SetWindowLongA",long:hwnd,long:GWL_STYLE,long:x)


#EndFunction

run("notepad.exe","")
RemoveMaxMinButtons("~Notepad")
Message("Debug","Wait")
AddMaxMinButtons("~Notepad")





Article ID:   W16237
File Created: 2004:03:30:15:43:32
Last Updated: 2004:03:30:15:43:32