Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CallWindowProc and WM_GetMinMaxInfo
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01392525
Message ID:
01393224
Views:
62
Eureeka!!! I found a different way to go about it and it works! It's actually much easier and I didn't end up using WM_GETMINMAXINFO.

Sergey, I couldn't have figured this out without your help.

Thanks again!
-m@

The explanation is easier in code:

This is in the INIT() of a custom object placed on a form that handles resizing constraints.
DECLARE INTEGER CallWindowProc IN user32;
        INTEGER lpPrevWndFunc, INTEGER hWindow, LONG Msg,;
        INTEGER wParam, INTEGER lParam

*--Fires when a move or resize starts.
*--This stores properties for the form's current (pre sized) top, left, right and bottom positions.
=BINDEVENT(ThisForm.HWnd, WM_ENTERSIZEMOVE, THIS, "StartedSizing",1)

*--Fires when a move or resize ends.
=BINDEVENT(ThisForm.HWnd, WM_EXITSIZEMOVE, THIS, "EndedSizing",1)

*--Fires repeatedly during resizing.
=BINDEVENT(ThisForm.HWnd, WM_SIZING, THIS, "IsSizing")
The IsSizing method:
LPARAMETERS tuNada1, tuNada2, tnWinEdge, tnRectStruPtr
*
*#DEFINE WMSZ_BOTTOM  6
*#DEFINE WMSZ_BOTTOMLEFT  7
*#DEFINE WMSZ_BOTTOMRIGHT  8
*#DEFINE WMSZ_LEFT  1
*#DEFINE WMSZ_RIGHT  2
*#DEFINE WMSZ_TOP  3
*#DEFINE WMSZ_TOPLEFT  4
*#DEFINE WMSZ_TOPRIGHT  5

*--Note: This.nSizingEdge is reset to 0 at the start of every sizing operation.
IF tnWinEdge <> This.nSizingEdge
  
  *--Sets the edge of the window that the user grabbed for sizing.
  This.nSizingEdge = tnWinEdge

  *--Sets mins and maxes based on the edge being sized.
  =This.SetWindowMinMaxSizes(This.nSizingEdge)
ELSE
  *--Get the current rect positions of the window from the struct.
  lnLeft = CTOBIN(SYS(2600,tnRectStruPtr+0,4),"RS") 
  lnTop = CTOBIN(SYS(2600,tnRectStruPtr+4,4),"RS") 
  lnRight = CTOBIN(SYS(2600,tnRectStruPtr+8,4),"RS") 
  lnBottom = CTOBIN(SYS(2600,tnRectStruPtr+12,4),"RS") 

  *--As a simple example, check to see if the right side was sized > 100 pixels wider 
  *--than it's original position.
  IF lnRight > (This.FormRightPre + 100)
    *--Assign the max value to a vbl.
    lcRightMax = BINTOC(This.FormRightPre + 100, "RS")

    *--Write the value back to the struct, overwriting the position the user moved it to.
    *--This has the effect of preventing the user from expanding the window beyond
    *--100 pixels wider than it's original position on the right side and can be done "on the fly".
    =SYS(2600, tnRectStruPtr+8, 4, lcRightMax)
  ENDIF 
ENDIF 
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform