Solved

Disable x-box (exit) on Property Sheet?

Posted on 1998-10-07
4
203 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 200 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dir function fails on mapped drives 28 148
Trouble with References... 5 63
C# LINQ ForEach() question 6 78
Mobile apps - web/native or hybrid? 1 65
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…

763 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