🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Program Update...

#9345
From: Shane Stump
Date: Sat, 17 Jul 2004 12:41
42 lines
2502 bytes
Thanks. That is ALMOST the process I have taken. Sicne I didn't write the
setup program, I actually wrote another "program" that I launch from my
application that I do pass the current process id and then it runs the
Setup.exe when it can.

I was just wondering if there was a hidden API command I didn't know about.

Regards,

Shane

"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:jqehf0d0r75u75ueq75mmlfd6fauqc4ula@4ax.com...
> Shane Stump wrote:
>
> >I am in the process of writing a component for my applications that check
/
> >download a new version of the program. The actual file that is downloaded
is
> >a setup program. Can anyone recommend the BEST way to shutdown my current
> >running application and launch the downloaded the Setup.exe?
>
> Well, it would seem like using CreateProcess on Setup.exe, then
> immediately terminating would do the job.
> But there is a race condition. Not so significant if Setup needs to
> unpack before it installs....but still...
>
> One way is for the application to use GetCurrentProcessId(), convert
> the ID to a string and pass that as a parameter to Setup.
>
> If Setup doesn't see the parameter, then it was manually started, so
> just go ahead and install.
> If Setup sees the parameter, it waits for the caller to close:
>
> ProcessID = atol(argv[1]);
> OldProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ProcessID);
> if( OldProcess != NULL )
> { WaitForSingleObject(OldProcess, INFINITE);
> CloseHandle(OldProcess);
> }
>
>
Technical Details
Message-ID: <40f91e80$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40f84e2c$1@newsgroups.borland.com> <jqehf0d0r75u75ueq75mmlfd6fauqc4ula@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7b54786b87ab9c42
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Shane Stump" <ShaneStumpNoSpam@StumpWare.com>
From: "Shane Stump" <ShaneStumpNoSpam@StumpWare.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40f84e2c$1@newsgroups.borland.com> <jqehf0d0r75u75ueq75mmlfd6fauqc4ula@4ax.com>
Subject: Re: Program Update...
Date: Sat, 17 Jul 2004 07:41:37 -0500
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 66.63.254.134
Message-ID: <40f91e80$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090068096 66.63.254.134 (17 Jul 2004 05:41:36 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail