?
Solved

How do I get createprocess to work?

Posted on 1998-08-04
3
Medium Priority
?
192 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 400 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

801 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