delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/12/16:42:52

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <20100212214239.HOJZ4.150765.root@hrndva-web25-z01>
Date: Fri, 12 Feb 2010 16:42:39 -0500
From: <turbowells AT maine DOT rr DOT com>
To: cygwin AT cygwin DOT com
Subject: Creating a separate console window via CreateProcess
MIME-Version: 1.0
Sensitivity: Normal
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019