🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ShellExecute

#8576
From: JF Jolin
Date: Sun, 17 Oct 2004 05:51
56 lines
2552 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));
 /*
   CreateProcess parameters info

   pointer to name of executable module pointer to command line string
   pointer to process security attributes
   pointer to thread security attributes
   handle inheritance flag
   creation flags
   pointer to new environment block
   pointer to current directory name
   pointer to STARTUPINFO
   pointer to PROCESS_INFORMATION
*/

   bProcessOk = CreateProcess(
                   (LPCTSTR) NULL,
                   (LPTSTR) szCommand,
                   (LPSECURITY_ATTRIBUTES) NULL,
                   (LPSECURITY_ATTRIBUTES) NULL,
                   (BOOL) TRUE,
                   (DWORD) CREATE_NEW_CONSOLE |
                           NORMAL_PRIORITY_CLASS,
                   (LPVOID) NULL,
                   (LPCTSTR) NULL,
                   (LPSTARTUPINFO) &StartupInfo,
                   (LPPROCESS_INFORMATION) &ProcessInformation);

-- 
JF Jolin
[Montreal, Canada]
Technical Details
Message-ID: <opsfz2jumpz6rw7b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!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: <opsfz2jumpz6rw7b@newsgroups.borland.com>
Content-Type: text/plain; charset=iso-8859-15; format=flowed
From: JF Jolin <jfj@nospam.com>
MIME-Version: 1.0
Date: Sun, 17 Oct 2004 01:51:20 -0400
User-Agent: Opera7.11/Win32 M2 build 2887
NNTP-Posting-Host: 66.158.146.164
X-Trace: newsgroups.borland.com 1097992285 66.158.146.164 (16 Oct 2004 22:51:25 -0700)
Lines: 56
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail