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

Dialog Boxes

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

Disable Minimize - Maximize Box Menus

 Keywords:  Disable remove minimize maximize

This code disables the minimize and maximize menus from a boxes title bar.

Note: This may not work with XP themed windows.

#DefineFunction udfDisableMenus(boxtitle)
	;This code disables the minimize and maximize menus
	;from a boxes title bar
	sc_minimize=  61472   ; 0x0F020
	sc_maximize=  61488   ; 0x0F030
	IntControl(12,1+4,0,0,0)
	hwnd=DllHwnd("") ;  "" is shortcut for the WInBatch BoxOpen window
	sysmenu=DllCall(strcat(DirWindows(1),"USER32.DLL"),long:"GetSystemMenu",long:hwnd,long:0)
	DllCall(strcat(DirWindows(1),"USER32.DLL"),long:"RemoveMenu",long:sysmenu,long:sc_minimize,long:0)
	DllCall(strcat(DirWindows(1),"USER32.DLL"),long:"RemoveMenu",long:sysmenu,long:sc_maximize,long:0)
	Return(1)
#EndFunction

title = "Hello"
BoxOpen(title,"World")
udfDisableMenus(title)
TimeDelay(5)
exit


This disables those menus for XP themed windows

#DefineFunction udfDisableXPMenus(boxtitle)
	user32=StrCat(DirWindows(1),"user32.dll")
	WS_MAXIMIZEBOX=65536
	WS_MINIMIZE=131072
	GWL_STYLE=-16
	handle=DllHwnd("") ; "" is shortcut for the WInBatch BoxOpen window
	oldstyle=DllCall(user32,long:"GetWindowLongA",long:handle,long:GWL_STYLE)
	newstyle=oldstyle & ~WS_MINIMIZE & ~WS_MAXIMIZEBOX
	DllCall(User32,long:"SetWindowLongA",long:handle,long:GWL_STYLE,long:newstyle)
#EndFunction

title = "Hello"
BoxOpen(title,"World")
udfDisableXPMenus(title)
TimeDelay(5)
exit

Article ID:   W15332
File Created: 2007:10:19:07:29:18
Last Updated: 2007:10:19:07:29:18