![]() |
|
#1
|
|||
|
|||
Exit a running program by pressing "Esc" keyHow can I exit a running program by pressing "esc" key? Actually I want to use it in my minesweeper assignment. The game is complete but only that portion is incomplete.
|
|||
|
#2
|
||||
|
||||
Re: Exit a running program by pressing "Esc" keyQuote:
Hope that you don't mind that this is a "C" response to your "C++" question, but it may work for your needs. CPP / C++ / C Code:
Output: Code:
MxB |
|
#3
|
|||
|
|||
Re: Exit a running program by pressing "Esc" keyyar your code is a little bit helpful i need to exit the runnig program at any instant.but your code only exit when compiler reades getchar() statement.thankx buddy.
|
|
#4
|
||||
|
||||
Re: Exit a running program by pressing "Esc" keyQuote:
Hello?! What did you tell us about "your program?" Nothing. What did you tell us about the system that you're using? Nothing. My code only "exits" when the compiler reads getchar is NOT TRUE. My code only exits when a conditional expression evaluates to true and that is when a character "c" is equal to the ASCII value for the escape key. If you want to exit the program "at any instant" then you probably will need a PLATFORM SPECIFIC method of trapping and/or handling the escape key. You'll note that you did not provide the platform you're using in any of your remarks. Therefore, I provided you with a platform agnostic way of responding to key presses. If that doesn't satisfy your requirements, do not "blame" my response, blame YOUR set of requirements as you posted. If you are using Windoze, which is highly likely considering your attention to detail, I'd recommend that you trap VK_ESC in your main Windows procedure when looking for WM_KEYDOWN. Of course, that is assuming a lot, which I didn't do previously. If you want to modify your requirements after posting, please do so, but don't act like I didn't "solve" the problem as you presented it simply because I didn't give you the answer that you wanted, but failed to ask in a specific and direct way. What makes you think that I will give you any more useful information than the computer that you're trying to program? It will do exactly what you tell it to do. If that isn't what you want, you need to approach the problem from a different perspective...because you haven't yet found the one that works, huh? MxB |
|
#5
|
|||
|
|||
Re: Exit a running program by pressing "Esc" keyI have posted complete code of my assignment. I am using Windows as operating system and dev as compiler. Now kindly tell me how would I exit the program at any instant by pressing esc key.
CPP / C++ / C Code:
Last edited by admin : 08-Mar-2009 at 07:42.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adsense Integration Guide | Extreme89 | AdSense Forum | 1 | 10-Jul-2006 07:04 |
| EbizWebDirectory.com - Best Ecommerce Directory your one stop online ecommerce guide | ebwebdirectory | Member Announcements, Advertisements & Offers | 0 | 16-Jan-2006 03:01 |
| complete e-marketing guide | primelibra | Search Engine Optimization Forum | 4 | 01-Aug-2004 20:45 |
| IRC Services Admin help guide | Allowee | Open Discussion Forum | 2 | 25-Apr-2004 08:32 |
| Sydog's DVD to Divx Conversion Guide | asanthadenz | Computer Software Forum - Windows | 1 | 14-Mar-2003 14:08 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The