Solved

How do I get createprocess to work?

Posted on 1998-08-04
3
186 Views
Last Modified: 2013-11-19
I am trying to launch a console app hidden.  Here is the code I am using:  

PROCESS_INFORMATION pi;
STARTUPINFO si;
si.wShowWindow =  SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW;

ProcessResult = CreateProcess("c:\\winnt\\system32\\write",NULL,NULL,NULL,true,NULL, NULL,NULL,&si,&pi);

Can someone provide me with an example, or a hint to what I am doing wrong?  The code executes, but returns with error code 0 - Nothing happens.

Thanks in advance.
0
Comment
Question by:jerryross
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
trestan earned 100 total points
ID: 1320235
PROCESS_INFORMATION pi={0};
STARTUPINFO si={0};
si.wShowWindow =  SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW;

ProcessResult = CreateProcess(NULL, "c:\\winnt\\system32\\write",NULL,NULL,TRUE,NULL, NULL,NULL,&si,&pi);
I think you should set the first para as NULL. Use the second as command line input.
0
 
LVL 8

Expert Comment

by:trestan
ID: 1320236
Also add: si.cb = sizeof(si);
0
 

Author Comment

by:jerryross
ID: 1320237
Thank you!  I really needed that to work.  Now, if I can make sure that I am closing all of the appropriate handles for the newly created process then It'll be working great!  I am closing the thread handle, and the process handle, but I think there is also a window handle to close.  If I can get that and close it that should work.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 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