Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable x-box (exit) on Property Sheet?

Posted on 1998-10-07
4
Medium Priority
?
206 Views
Last Modified: 2013-12-03
Is there a way to disable the functionality of the little "X-Box" on the top right of the dialog? This X-Box is the button that acts identical to the CANCEL button.
I am using Visual C++ (although all my code is written in C - so I'm not using any classes (e.g. MFC))!

Thanx in advance
0
Comment
Question by:nweiher
[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
4 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1415053
Do you mean your own dialog box (should be easy) or do you mean the dialog box of another process (a little bit more difficult).

Regards, Madshi.
0
 

Author Comment

by:nweiher
ID: 1415054
My own dialog box ...
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 400 total points
ID: 1415055
1. To hide and disable the button make sure the WS_SYSMENU style isn't set for the property sheet

2. If you want to handle the user clicking on this button and do something different (e.g. do nothing) process the WM_SYSCOMMAND message.

There is no disabled appearance for this button built-in to Windows (you could simulate it by handling the WM_NCPAINT message and paiting non-client areas of the property sheet, but I wouldn't advise it).  The normal convention in Windows is not have this button (solution #1) if you don't need it.
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1415056
Answer2000, It seems you are wrong. I've prepared the answer, submit it, but you was the first :(

LONG oldstyle;

. DialogProc(HWND dlg,UINT hMsg,...)
{
  ...
case WM_INITDIALOG:
  oldstyle=GetClassLong(dlg,GCL_STYLE);
  SetClassLong(dlg,GCL_STYLE,oldstyle | CS_NOCLOSE);
  ...
case WM_DESTROY:
  SetClassLong(dlg,GCL_STYLE,oldstyle);
  ...
}

Keep in mind, we are modifying the dialog class, so it can affect all dialogs in your app.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 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