🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12686

ShellExecute Error

#12686
From: George
Date: Thu, 20 Nov 2003 23:39
38 lines
1898 bytes
Hi I want to execute the following command

mysqldump.exe --user=root --password=pass --database=data1 > c:\output.txt

and wait until finishes. So I:

   SHELLEXECUTEINFO ExecInfo= {0};
   bool result=false;
   ExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
   ExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
   ExecInfo.hwnd = GetDesktopWindow();
   ExecInfo.lpVerb = "Open";
   ExecInfo.lpFile = "c:\\mysqldump.exe";
   ExecInfo.lpParameters = "--user=root --password=pass --database=data1 >
c:\output.txt";
   ExecInfo.lpDirectory = "c:\\";
   ExecInfo.nShow=SW_SHOW;

   result = ShellExecuteEx(&ExecInfo);

  if (!result) {
   };
   else {
     DWORD ProcRes=STILL_ACTIVE;
      while(ProcRes == STILL_ACTIVE) {
      GetExitCodeProcess(ExecInfo.hProcess,&ProcRes);
      Application->ProcessMessages();
   }

   ShowMessage("Result Code=" + IntToStr(ProcRes));


Everything works fine but that "> output.txt" seems to make it fail. If I
put all the command
as it is inside a bat file and I execute with the above way, everything
looks fine.

Any idea please?
Technical Details
Message-ID: <3fbd4eec$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9b656969a1fc70df,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-20 15:41:28 PST
From: "George" <george@nospam.org>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: ShellExecute Error
Date: Fri, 21 Nov 2003 01:39:47 +0200
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 212.205.250.182
Message-ID: <3fbd4eec$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1069371116 212.205.250.182 (20 Nov 2003 15:31:56 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail