Disabling abililty to close DOS window with "X"

G

Guest

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.
 
P

Phil Robyn

Steve said:
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?
 
J

Jon

Steve said:
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
 
G

Guest

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.

Jon said:
Steve said:
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
 
J

Jon

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 said:
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.

Jon said:
Steve said:
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
 
G

Guest

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?

Jon said:
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 said:
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.

Jon said:
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
 
U

Uwe Sieber

Steve said:
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
 
U

Uwe Sieber

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
 
G

Guest

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

Thanks.
 
U

Uwe Sieber

Steve said:
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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top