Re: Disabling abililty to close DOS window with "X"

17 views
Skip to first unread message

Phil Robyn

unread,
Feb 15, 2006, 1:53:54 PM2/15/06
to
Steve wrote:

> I have a special DOS program running on Windows XP and when my users close
> the program with the "X" on the title bar it causes lots of issues. Is there
> away to disable the "X"?
>
> Thanks for any suggestions.

Why don't you just run it minimized?

--
Phil Robyn
University of California, Berkeley

Jon

unread,
Feb 15, 2006, 1:59:58 PM2/15/06
to

"Steve" <St...@discussions.microsoft.com> wrote in message
news:6E822C59-3EB1-4A89...@microsoft.com...

>I have a special DOS program running on Windows XP and when my users close
> the program with the "X" on the title bar it causes lots of issues. Is
> there
> away to disable the "X"?
>
> Thanks for any suggestions.

You could run the program "invisibly" eg by having another program start it
invisibly eg using a vbscript "wrapper" [WshShell "Run" method]

Alternatively, if you need some kind of user interaction, and you have
access to a package, that can enable you to create a small dialog, such as
Visual Basic, Visual C++, Visual Studio, then that is something you can
readily disable in your own custom dialog.

Jon

Jon

unread,
Feb 15, 2006, 3:28:11 PM2/15/06
to
Another alternative might be to run it in "Full screen mode"
Adding DWORD value key of name "FullScreen" and value 1
at HKEY_CURRENT_USER\Console, causes cmd.exe to open up full screen.
(Changing that value to 0, causes cmd.exe to open up normally)

eg
cmd /k programname.exe

after making the above change
(Type exit or ALT-Enter, or Windowskey-D, Windowskey-M to leave full screen
mode)

Jon


"Steve" <St...@discussions.microsoft.com> wrote in message

news:B1DBD1CC-0AC7-4FEE...@microsoft.com...
> This program needs to be used by the users. It is a POS sales program. But
> it
> needs to be exited by having the user escape out. When they close it using
> the X it causes errors in the database file.

Steve

unread,
Feb 15, 2006, 5:37:29 PM2/15/06
to
No, can't do that either..they use other programs and they wouldn't handle
getting out of full screen very well...they can't handle closing the program
correctly!! That's why I'm trying to take the ability away from them.

What about hiding the title bar? Is there an easy way to do that maybe?

Uwe Sieber

unread,
Feb 16, 2006, 5:13:22 AM2/16/06
to

Steve wrote:
> I have a special DOS program running on Windows XP and when my users close
> the program with the "X" on the title bar it causes lots of issues. Is there
> away to disable the "X"?
>
> Thanks for any suggestions.

I wanted to write such a little tool for a long
time. Not I did and I think I found a volunteer
for testing it :-)

http://www.uwe-sieber.de/files/consolenoclose.zip


Greetings from Germany

Uwe

Steve

unread,
Feb 21, 2006, 2:16:27 PM2/21/06
to
Thank you! It worked excellent!! Nice job!

Steve

Uwe Sieber

unread,
Feb 22, 2006, 5:39:38 AM2/22/06
to

I've updated the tool yesterday. Now you can use the
commandline parameter /1 to make it disabling the
X button for the next console window it finds and
end then.
Without the parameter it stays in the background and
polls the foreground window for ever.


Greetings from Germany

Uwe

Steve

unread,
Mar 23, 2006, 4:26:02 PM3/23/06
to
Very nice. I've been wanting to play around with learning this myself. What
did you create this in?

Thanks.

Uwe Sieber

unread,
Mar 24, 2006, 3:11:30 AM3/24/06
to

Steve wrote:
> Very nice. I've been wanting to play around with learning this myself. What
> did you create this in?

The X button is internally linked with the Close command
in the window's system menu. So disabling and removing
the Close item from the menu grays out the X button.

In VB:

Sub DisableCloseButton(h As Long)
Dim hMenu As Long
hMenu = GetSystemMenu(h, 0)
Call EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED Or MF_DISABLED)
Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
End Sub


Greeting from Germany

Uwe

JohnW

unread,
Mar 29, 2006, 5:41:01 PM3/29/06
to
This looks like exactly what we want, would it be possible to get the
complete code so we can look at this? We tried compiling the code but
receive errors.

Thank You

Reply all
Reply to author
Forward
0 new messages