Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overriding the minimize, size and close toolbar buttons

Status
Not open for further replies.

shades234

Technical User
Aug 7, 2006
4
US
hi, i'm new here and have a programming question


I'm developing a SDI program with database use. I want to override the buttons in the top right of the screen, the _, the resize and the (x) close buttons.

what i really want is for the users not to be able to resize the windown in any way, and if they hit [x] to close, it brings up a box asking if they really want to close. i was able to get the File->Close to refer to the close button i made.

can anyone point me in the right direction
 
Remove them if you don't want them, if you're using Windows forms it's just a setting in the properties tab.... otherwise if you want to do it in code you need to use the SetWindowLong() function and set the style as not WS_MINIMIZEBOX & not WS_MAXIMIZEBOX

As far as the close confirmation just put what you want in the appropriate message handler, WM_DESTROY if I'm not mistaken, but that may be too late I'm not certain.
 
i tried that, but if the user doubble clicks on the top tool bar even if the min and max buttons aren't there, the program still does a resize and then i can't get the program to maximize
 
Are you using Windows forms? If so, have you set the resizable flag to false?
 
windows forms?

i just mfc to create an sdi,that's about all i know.
 
Try responding to the WM_SIZE message and not letting the size be smaller than full screen.

For the close, I think you want WM_CLOSE; WM_DESTROY is too late. There's also a message that asks the program if it is in a state where it can close. If necessary I can find it for you.
 
i reid the close and destroy but they happened after my event.

i found that using the mainfrm.cpp and working with the close in there is fine, but i need to save data from my program, is there a way to access it from mainfrm.cpp? my data is stored in "Connector TestView.cpp" but the class is CConnectorTestView
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top