delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/09/25/16:15:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "skylazart" <skylazart AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fork () system () in windows 32
Date: 25 Sep 2006 13:03:03 -0700
Organization: http://groups.google.com
Lines: 59
Message-ID: <1159214583.693888.18540@m73g2000cwd.googlegroups.com>
References: <1158958792 DOT 016136 DOT 195840 AT e3g2000cwe DOT googlegroups DOT com>
<200609222113 DOT k8MLD7Fd030125 AT envy DOT delorie DOT com>
NNTP-Posting-Host: 200.220.224.33
Mime-Version: 1.0
X-Trace: posting.google.com 1159214589 18242 127.0.0.1 (25 Sep 2006 20:03:09 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Mon, 25 Sep 2006 20:03:09 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060904 Debian/1.7.8-1sarge7.2.2,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 ISA01
Complaints-To: groups-abuse AT google DOT com
Injection-Info: m73g2000cwd.googlegroups.com; posting-host=200.220.224.33;
posting-account=3HlXAA0AAADjCUweOPFDY0dx_Y4v75jD
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sorry,

Im using devCPP IDE.

I have solved the problem with CreateProcess ()

void OpenNotepad (char * file)
{
    char cmd[8192];
    BOOL success = 0;
    STARTUPINFO si;
    ZeroMemory(&si, sizeof(si));
    si.cb=sizeof(si);
    si.lpReserved=NULL;
    si.lpDesktop="Default";
    si.lpTitle=NULL,
    si.dwFlags=STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_SHOWMAXIMIZED;
    si.cbReserved2=0;
    si.lpReserved2=NULL;

    PROCESS_INFORMATION pi;
    ZeroMemory( &pi, sizeof(pi) );

    if (file == NULL)
    {
       success = CreateProcess(NOTEPAD,
			       NULL,
			       NULL, NULL, FALSE,
			       DETACHED_PROCESS,
			       /* CREATE_NEW_CONSOLE is the same :( */
			       NULL, NULL, &si, &pi);
    }
    else
    {
       snprintf (cmd, sizeof (cmd), "%s %s", NOTEPAD, file);

       success = CreateProcess(NULL,
			       cmd,
			       //"C:\\WINDOWS\\NOTEPAD.EXE c:\\la.txt",
			       //"c:\\la.txt",
			       NULL, NULL, FALSE,
			       DETACHED_PROCESS,
			       /* CREATE_NEW_CONSOLE is the same :( */
			       NULL, NULL, &si, &pi);
    }
}

Tkz!!!



DJ Delorie wrote:
> Sorry, djgpp isn't a windows compiler (it's a dos compiler that
> happens to run under windows), so you don't have access to
> windows-specific things like process control.
> 
> Try cygwin if you need a real posix fork().

- Raw text -


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