🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ShellExecute

#8573
From: JF Jolin
Date: Sun, 17 Oct 2004 02:32
45 lines
2454 bytes
15 Oct 2004 08:25:08 -0700, David Ayre wrote:

>
> I use ShellExecute to run another executable from my application. When 
> run on Windows XP I get a warning message that this file might damage my 
> computer.
> Is there any way of suppressing this?
>
> Cheers,
>
> David
>

You could have a much better control over executable launching with 
CreateProcess()

   STARTUPINFO           StartupInfo;
   PROCESS_INFORMATION   ProcessInformation;
   BOOL                  bProcessOk;

   memset(&StartupInfo, 0, sizeof(STARTUPINFO));
   StartupInfo.cb           = sizeof(STARTUPINFO);
   StartupInfo.dwFlags      = STARTF_USESHOWWINDOW;
   StartupInfo.wShowWindow  = SW_SHOWNORMAL;
   memset(&ProcessInformation, 0, sizeof(PROCESS_INFORMATION));

   bProcessOk = CreateProcess(
                   (LPCTSTR) NULL,                    // pointer to name of 
executable module (LPTSTR) szCommand,                // pointer to command 
line string
                   (LPSECURITY_ATTRIBUTES) NULL,      // pointer to process 
security attributes (LPSECURITY_ATTRIBUTES) NULL,      // pointer to thread 
security attributes (BOOL) TRUE,                       // handle 
inheritance flag (DWORD) CREATE_NEW_CONSOLE |
                           NORMAL_PRIORITY_CLASS,     // creation flags 
(LPVOID) NULL,                     // pointer to new environment block 
(LPCTSTR) NULL,                    // pointer to current directory name 
(LPSTARTUPINFO) &StartupInfo,      // pointer to STARTUPINFO 
(LPPROCESS_INFORMATION) &ProcessInformation);  // pointer to 
PROCESS_INFORMATION


-- 
JF Jolin
[Montreal, Canada]
Technical Details
Message-ID: <opsfztbx0ez6rw7b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <416febd4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,345bff3d3bc63eb6
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: ShellExecute
References: <416febd4$1@newsgroups.borland.com>
Message-ID: <opsfztbx0ez6rw7b@newsgroups.borland.com>
Content-Type: text/plain; charset=iso-8859-15; format=flowed
From: JF Jolin <jfj@nospam.com>
MIME-Version: 1.0
Date: Sat, 16 Oct 2004 22:32:11 -0400
User-Agent: Opera7.11/Win32 M2 build 2887
NNTP-Posting-Host: 66.158.141.147
X-Trace: newsgroups.borland.com 1097980340 66.158.141.147 (16 Oct 2004 19:32:20 -0700)
Lines: 45
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail