This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Creating a separate console window via CreateProcess


I am building a application using the latest tools available via the cygwin 
setup program.  The application is supposed to open a separate DOS console 
window, but all processing seems to occur within the context of the DOS console 
window where I execute the program. 
 
I have cut the program down to the code that just does the process creation.  I 
would want the following program to open a separate DOS window to ask me for a 
password for the rexec command. 
 
I built the test program with: gcc -mno-cygwin  creprc.c -o creprc 
 
Could someone help me understand what I am doing wrong? 
 
-Jeff 
 
#include <windows.h> 
#include <shellapi.h> 
#include <string.h> 
 
main() 
{ 
  char buffer[128]; 
  STARTUPINFO start; 
  PROCESS_INFORMATION child; 
 
  strcpy (buffer, "rexec testhost -l testuser testcommand"); 
  memset (&start, 0, sizeof (start)); 
  start.cb = sizeof (start); 
  start.dwFlags = STARTF_USESHOWWINDOW; 
  start.wShowWindow = SW_NORMAL; 
 
  memset (&child, 0, sizeof (child)); 
 
  if (CreateProcess (NULL, buffer, NULL, NULL, FALSE, 0, 
		NULL, NULL, &start, &child)) 
  { 
	CloseHandle (child.hThread); 
	CloseHandle (child.hProcess); 
  } 
} 


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]