473,503 Members | 13,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pause in console apps

When you run a console app in VS6 it says "Press any key too continue..."
how can i do that in VS.NET2003?

thanks
Nov 16 '05 #1
5 44940
Console.WriteLine("Press any key too continue...");
Console.ReadLine();
// continue...

--
William Stacey, MVP

"Aaron" <ku*****@yahoo.com> wrote in message
news:#n**************@TK2MSFTNGP10.phx.gbl...
When you run a console app in VS6 it says "Press any key too continue..."
how can i do that in VS.NET2003?

thanks


Nov 16 '05 #2
William Stacey [MVP] wrote:
Console.WriteLine("Press any key too continue...");
Console.ReadLine();
// continue...
"Aaron" <ku*****@yahoo.com> wrote in message
news:#n**************@TK2MSFTNGP10.phx.gbl...
When you run a console app in VS6 it says "Press any key too
continue..." how can i do that in VS.NET2003?

thanks


Note that Console.ReadLine() only returns on a newline (the enter key), not
any key.
- Pete
Nov 16 '05 #3
Have a variable incremented in KeyDown event.
Print out the message "Press any key..."
AforeMentionedVariable = 0;
while (AforeMentionedVariable == 0);
--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com

"Aaron" <ku*****@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
When you run a console app in VS6 it says "Press any key too continue..."
how can i do that in VS.NET2003?

thanks

Nov 16 '05 #4
Alex Moskalyuk <us****@moskalyuk.com> wrote:
Have a variable incremented in KeyDown event.
Which KeyDown event is that, in a console app?
Print out the message "Press any key..."
AforeMentionedVariable = 0;
while (AforeMentionedVariable == 0);


That's not guaranteed to *ever* finish, unless the variable is volatile
- and even if the variable were volatile, you'd still be taking up 100%
CPU until someone pressed a key. Tight loops like that should (almost)
never be used for that kind of thing - it's what Monitor.Wait/Pulse was
designed for.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
You're right, my bad. I was just working with textboxes that looked like
consoles and were called consoles (black backgrounds, white characters),
being in fact textboxes. Missed the fact that he asked for Win32 console
app.
--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Alex Moskalyuk <us****@moskalyuk.com> wrote:
Have a variable incremented in KeyDown event.


Which KeyDown event is that, in a console app?
Print out the message "Press any key..."
AforeMentionedVariable = 0;
while (AforeMentionedVariable == 0);


That's not guaranteed to *ever* finish, unless the variable is volatile
- and even if the variable were volatile, you'd still be taking up 100%
CPU until someone pressed a key. Tight loops like that should (almost)
never be used for that kind of thing - it's what Monitor.Wait/Pulse was
designed for.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
357
by: Aaron | last post by:
When you run a console app in VS6 it says "Press any key too continue..." how can i do that in VS.NET2003? thanks
5
4112
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas...
8
36403
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
1
547
by: Dan Williams | last post by:
Does anyone know if its possible to pause the console output if my console app tries to write data past the current command prompt buffer? In other words, behave much like the 'more' command, in...
3
1452
by: GG | last post by:
I have a console app that when it is run and I press a key then it freezes till a press another key gain. Is there a way to avoid it that is the keystrokes do not pause the app? Thanks ...
6
6614
by: Mark Broadbent | last post by:
Firstly I am not after a programatic solution (e.g. Console.ReadLine() or a Loop construct). I am trying to find an option in the IDE to pause on exit. For instance with the SharpDevelop IDE...
5
11191
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
6
45547
by: kai | last post by:
Hi, When I use Console.WriteLine("Hello") in my code, it displays DOS screen so fast, how do I pause the Console screen? Thanks Kai
0
1374
by: Arik | last post by:
Hi, I would like to disable the 'Pause/Break' key in a console application. Normally, pressing the 'Pause' key halts the application's execution and may lead to undesirable processing gaps in my...
6
4033
by: Peted | last post by:
Hi wondering what is the best way to do this Need a user to click a button, that sends 3 or 4 string based commands via a TCP/ip socket link I can connect to the ip device no problems, am...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.