Solved

How do I get createprocess to work?

Posted on 1998-08-04
3
189 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

Independent Software Vendors: 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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 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