Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hiding the Min and Max buttons on an MDI window
Message
 
To
21/07/2014 14:02:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01604253
Message ID:
01604260
Views:
103
This message has been marked as the solution to the initial question of the thread.
Likes (1)
>>>Hi All,
>>>
>>>I want to hide the minimize and maximize buttons on an MDI window. I have found a Microsoft article which seems to be exactly what I want to achieve here:
>>>
>>>http://support.microsoft.com/kb/137033
>>>
>>>However, I am not sure how to convert the VB code to VFP. I understand the API calls themselves, that is straight forward enough. But I do not understand what the constant declarations are as in:
>>>
>>>
>>>    Const WS_MINIMIZEBOX = &H20000
>>>    Const WS_MAXIMIZEBOX = &H10000
>>>
>>>
>>>... or how to use them in calculating a new value for "L" as in:
>>>
>>>
>>>         L = GetWindowLong(Me.hWnd, GWL_STYLE)  
>>>         L = L And Not (WS_MINIMIZEBOX)
>>>         L = L And Not (WS_MAXIMIZEBOX)
>>>         L = SetWindowLong(Me.hWnd, GWL_STYLE, L)
>>>
>>>
>>>What is &H20000 and &H10000 ? How can I do this in VFP?
>>>
>>>Any help appreciated.
>>
>>Change the MinButton and the MaxButton of either the form or the _screen to .f.
>
>Thanks Mike. I would still like to know how to do this via these API calls :)

Try this in the init of the form.
DECLARE INTEGER SetWindowLong IN user32;
    INTEGER HWND,;
    INTEGER nIndex,;
    INTEGER dwNewLong

  
DECLARE INTEGER GetWindowLong IN user32;
    INTEGER hWnd, INTEGER nIndex
 
 


#DEFINE GWL_STYLE -16
#DEFINE WS_MINIMIZEBOX 0x20000
#DEFINE WS_MAXIMIZEBOX 0x10000

lnhwnd = thisform.hwnd
CurrentStyle = GetWindowLong(lnhwnd, GWL_STYLE)

*!* Both min and max must be removed before they actually disappear
*!* otherwise buttons are just disabled individually but still shown
CurrentStyle = BITAND(CurrentStyle, BITNOT(WS_MINIMIZEBOX))
CurrentStyle = BITAND(CurrentStyle, BITNOT(WS_MAXIMIZEBOX))

*!* code similar to this commented out stuff is used to turn on the buttons
*!*    CurrentStyle = BITOR(CurrentStyle, WS_MINIMIZEBOX)
*!*    CurrentStyle = BITOR(CurrentStyle, WS_MINIMIZEBOX)

X = SetWindowLong(THISFORM.HWND, GWL_STYLE, CurrentStyle)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform