This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 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]

Re: request for new feature


On Mon, 4 Aug 2003, David Fraser wrote:

> >I can send you code which spawns new processes from a running windows app.
> Could you send it to the list?

	
    /* we must build this string with information about mount points */
    const char* command = "c:\\cygwin\\usr\\x11r6\\xterm.exe -display :0.0";

    STARTUPINFO startupinfo;
    PROCESS_INFORMATION processinformation;
    memset(&startupinfo, 0, sizeof startupinfo);
    startupinfo.cb = sizeof startupinfo;

    if (!CreateProcess(
	"xterm", command,					// name and commandline 
	NULL, NULL, false, 					// Not important 
	/* CREATE_NEW_CONSOLE | */ CREATE_NEW_PROCESS_GROUP,    // Process flags. Maybe 0 is sufficient for our needs
	NULL,							// Environment. Null inherits from parent process
	NULL, 							// Working dir. Null uses current dir. 
	startupinfo, &processinformation			// Process information.
	))
    {
	// error
    }

or for cygwin 

int pid = fork();
if (pid == 0) {
	execl("/usr/X11R6/bin/xterm.exe", "-display", ":0.0", NULL);
} else if (pid == -1) {
	// error
}
-- 
 Alexander.Gottwald@s1999.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723


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