I set the "controlbox" property to .F. but I want to keep the MinButton and close button on the right-up corner of the form. How can I do it ? Thank you for your help.
Thanks for your help.But the problem is that I must set the "Controlbox" property to .F. and the MinButton property to .T.
How can I do that ?
This code below should give you some idea of what you are butting up against here. Windows just doesn't work that way, even natively using API calls. You ultimately will need to draw your own MIN and CLOSE buttons if you want to do this...getting rid of the MAX button from between them is not a trivial thing...now if you just wanted to disable the max button and have the controlbox = .f. that may in fact be possible...maybe i say.
*!* 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)
*!* just a quick hack to refresh controlbox
thisform.controlbox = .f.
thisform.controlbox = .t.
Slighthaze = NULL craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon
Let us say... by Double Click on the form, minimize that, and double click on the titlebar of the minimized form, it restores the position. If this is OK to you, then
Put in the Forms DoubleClick event
ThisForm.WindowState = 1
This is the reason I have to need the controlbox = .F.
Public oform1
oform1=createobject("form1"
oform1.Show
Return
******************************************************
Define Class form1 As Form
DoCreate = .T.
Caption = "My Form"
****** cannot define icon in a class("syspath" is a public variable define in my main prg)
Icon = "&syspath\ico\abc.ico"
************************************
Name = "Form1"
AutoCenter = .T.
ShowWindow = 2
WindowState = 2
enddefine
RE:slighthaze
Error message:
"File GetWindowLong.prg does not exist"
The error in my code is because i inadvertantly removed the DECLARE statement for the GetWindowLong API function call before posting it (was trying some other stuff and then at the last minute tried to put it back the way it was). Place the following right below the other 2 declares and it will work. Sorry about that.
DECLARE INTEGER GetWindowLong IN user32;
INTEGER hWnd, INTEGER nIndex
As for your reason to Mike for needing the controlbox = .F., I am not sure I understand. I have looked at your code and still cannot figure out the reason. Am I missing something?
Slighthaze = NULL craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon
Actually I built a About me form, I wanted to remove the controlbox. But now I understand that is probably impossible for VFP users. Thanks for the help all of you give to me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.