WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: erezpaz on January 28, 2017, 08:13:28 AM

Title: Prevent box resize
Post by: erezpaz on January 28, 2017, 08:13:28 AM
Hi

I create a box with information and want to prevent users from changing the size of it with the mouse (drag one of the corners).

BoxesUp("200, 200, 800, 800", @NORMAL)

Can you help?
Thanks
Title: Re: Prevent box resize
Post by: td on January 28, 2017, 10:32:32 AM
This  works on the main box.  You would need to get the window handle of any secondary boxes before calling the UDF on one.

Code (winbatch) Select
#definefunction RemoveWindowStyle(hWnd, nStyle)
   hUser32 = DllLoad('user32.dll')
   GWL_STYLE = -16 ; Offset for the Window Style value.
   nCurStyle = dllcall(hUser32,long:"GetWindowLongA",long:hWnd,long:GWL_STYLE)
   nCurStyle &= (~nStyle)
   nResult   = dllcall(hUser32,long:"SetWindowLongA",long:hWnd,long:GWL_STYLE,long:nCurStyle)
   DllFree(hUser32)
   return nResult
#endfunction


nStyle = 262144 ; Thick frame style
BoxesUp("200, 200, 800, 800", @NORMAL)
hBox = DllHwnd("")
RemoveWindowStyle(hBox, nStyle)
TimeDelay(5)