Solved

getting rid of DOS console window

Posted on 2002-03-15
3
388 Views
Last Modified: 2008-02-01
I start a process using CreateProcess as follows, which starts with a minimized DOS console window which, in turn, starts a GUI. I want the console window closed automatically when the GUI is closed. I tried the following code. It doesn't work.
----------------------------------
CreateProcess(NULL,"cmd.exe /c start /min test.bat",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&StartInfo,&pInfo);
HANDLE hp=pInfo.hProcess;
LPDWORD pExitCode=NULL;
GetExitCodeProcess(hp, pExitCode);
ExitProcess(*pExitCode);
----------------------------------
0
Comment
Question by:j4months
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6869245
What is your "STARTUP_INFO" struct like?

It should be

 STARTUPINFO siStartInfo;

    // Set up the start up info struct.
    ZeroMemory(&siStartInfo,sizeof(STARTUPINFO));
    siStartInfo.cb = sizeof(STARTUPINFO);
    siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
    siStartInfo.wShowWindow = SW_HIDE;
0
 

Author Comment

by:j4months
ID: 6869433
I modified the STARTUPINFO as you described, it didn't make a difference..
actually my problem is not at the startup. it's when I close the GUI window..
0
 
LVL 1

Accepted Solution

by:
allym earned 50 total points
ID: 6869563
What's in the batch file? Try putting "exit" as the last command.

0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question