473,770 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to keep console window open

When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWA IT, my_program, ......),
it opens a new console window but when it is finished the
window is automatically closed.

Is there any way I can keep the window open even after the
program terminated (I want to be able check the output) ?

Thank you.
Nov 16 '05 #1
2 6648
Bumbrlik wrote:
When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWA IT, my_program, ......),
it opens a new console window but when it is finished the
window is automatically closed.

Is there any way I can keep the window open even after the
program terminated (I want to be able check the output) ?


You can allocate the console before executing the app.

Just call "AllocConsole() ;".
After you checked the output you can call "FreeConsole(); "

It works at least for CreateProcess (but should also work for spawn;
because it uses CreateProcess).
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
Nov 16 '05 #2
Thank you, that works great !!!
-----Original Message-----
Bumbrlik wrote:
When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWA IT, my_program, ......),
it opens a new console window but when it is finished the window is automatically closed.

Is there any way I can keep the window open even after the program terminated (I want to be able check the
output) ?
You can allocate the console before executing the app.

Just call "AllocConsole() ;".
After you checked the output you can call "FreeConsole(); "

It works at least for CreateProcess (but should also work for spawn;because it uses CreateProcess).
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
.

Nov 16 '05 #3

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

Similar topics

2
3081
by: Ram | last post by:
I have a console application that brings up a dialog if invoked with no command line parameters. If I double click on my application a console window is briefly displayed before the dialog appears (I have this code in my app: if (args.length ==0) FreeConsole() which causes the console to be closed) Is there a way to prevent this console window from appearing in the first place.
5
34265
by: Richard Lionheart | last post by:
Hi All, When I create a Console app in VS.net and run it, the Console window opens briefly and closes. If I was running a .bat command file, I'd append a pause stmt at the end. What can I do in VS? I'm a newbie and keeping that window open would be helpful for studying. Thanks in advance, Richard
11
4856
by: objectref | last post by:
Hi to all, i have a window app and i want to display some info in a console window. I figured out (after a very long search...) how am i supposed to do it and i try using the following code. The problem is that ok is set to true, con is set to a number (all fine until here) the console window appears but the string "anthonyb" is never displayed there...
1
1434
by: David A. Osborn | last post by:
I am currently working on a program that either works in a GUI or via console depending on what is passed in arguements at runtime. However, every time it is ran in GUI it still opens a console window and leaves it there until the program is closed. Does this happen simply because I am reading in arguements or could it be because I originally set the solution up as a console program? If it is because of how I set the solution up is...
5
18598
by: thinktwice | last post by:
<package> <job id="js"> <script language="JScript"> var WshNetwork = WScript.CreateObject("WScript.Network"); var oDrives = WshNetwork.EnumNetworkDrives(); var oPrinters = WshNetwork.EnumPrinterConnections(); WScript.Echo("Domain = " + WshNetwork.UserDomain); WScript.Echo("Computer Name = " + WshNetwork.ComputerName); WScript.Echo("User Name = " + WshNetwork.UserName); WScript.Echo();
3
4962
by: Jason | last post by:
I've got a simple program in which I just write something to the console output window, but when I compile and run the program, the output windows displays the output and closes right away. How do I configure it to have the console window stay open so I can view the output without it closing. Thanks Jason
6
5713
by: tony | last post by:
Hello! When you have windows forms you have the same possibility as when you have a Console application to use Console.Writeln to write whatever on the screen. Now to my question: Is it possible to use Console.Writeln when you have a Webservice. I don't think it's possible but just to be sure I ask you?
5
10776
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in server. Now, every console program instance will open a command mode window and they occupy the whole screen. I want to minimize all of them and maximize it if neccessary by manual. Is it possible and how to do it? I'm using VB.NET 2005. ...
0
1476
by: stefburn | last post by:
Hello Folks, Okay so I'm running a server window to debug some issues. I can keep the server window open by going to the path and opening a command prompt at the path of the <server.exe> file but that the text stops before too long. I know this because when I look at the server log I see that the text has a timestamp of events still occurring. So my question is what do I have to type in the Target box, what params or switches do I type in...
0
10254
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8929
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.