[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

disable close/minimize boxes

Posted on 2002-05-23
10
Medium Priority
?
207 Views
Last Modified: 2013-11-20
hi,
how can i disable the close and minimze boxes in a simple formview?
thanks
0
Comment
Question by:talsp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 4

Expert Comment

by:mblat
ID: 7031115
Disable or remove?

to remove you need to overwrite PreCreateWindow and remove
some styles

Something in line of

LONG lStyle = ::GetWindowLong(hWnd, GWL_STYLE);
lStyle &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
::SetWindowLong(hWnd, GWL_STYLE, lStyle);

To disable close button use

EnableMenuItem(::GetSystemMenu(AfxGetMainWnd()->m_hWnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);

Hope it helps...

0
 
LVL 4

Expert Comment

by:mblat
ID: 7031172
Or, by the way.

The only way I know of to disable minimize/maximize buttons is to delete corresponing menu items

DeleteMenu(::GetSystemMenu(AfxGetMainWnd()->m_hWnd,FALSE), SC_MINIMIZE, MF_BYCOMMAND);

after that minimiza item no longer present on system menu, and while minimize button still present and seems active it doesn't do anything....

0
 

Author Comment

by:talsp
ID: 7031495
i was looking for a way to disable the close/minimze boxes in the child windows.

can u help me out with it?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:orange_juice
ID: 7032027
mblat's way should work
0
 
LVL 4

Expert Comment

by:mblat
ID: 7032252
It should be the same instead of AfxGetMainWnd() use CWnd* of a window that you want disabled....
If you are in that window you can use this pointer.
0
 

Author Comment

by:talsp
ID: 7032334
its wierd, i am doing:
DeleteMenu(::GetSystemMenu(this->m_hWnd,FALSE), SC_MINIMIZE, MF_BYCOMMAND);

in the CFormView i am using but nothing happens.
the minimize box still working.
0
 
LVL 4

Accepted Solution

by:
mblat earned 150 total points
ID: 7032555
Does "Minimize" menu item still exist?  
By the way the simpliest way to prevent user to minimize your app is to overwrite SC_MINIMIZE message.  
May be you can do that?
0
 

Author Comment

by:talsp
ID: 7033115
Minimize menu doesn't exist.

its wierd i did the same with the SC_CLOSE and its working great, no close option in menu and the X button don't work.

btw: how do i overwrite th SC_MINIMIZE?
thanks

0
 

Author Comment

by:talsp
ID: 7033135
thanks a lot
i had another flag i didn't notice.
it working great.
thanks.
0
 
LVL 4

Expert Comment

by:mblat
ID: 7033152
Why B then?  Moderator!  Help!!!!!!!!!!!!!!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question