Article View: borland.public.cppbuilder.nativeapi
Article #4794closing form
From: Alfred
Date: Wed, 23 Nov 2005 01:13
Date: Wed, 23 Nov 2005 01:13
27 lines
1874 bytes
1874 bytes
Hello,
I am writing some few line of code to copy and execute a simple program. Now it copy and execute it correctly but my application do not quit...
here is the code.
It seem the problem is in FormCreate, if i put the code somewhere else after the form appair it work, but i need it before the form appair so I can run another .exe file and close the main application without showing it.
How can i do ?
void __fastcall TForm1::FormCreate(TObject *Sender)
{
if (ExecuteFile("Downloader.exe"))
Form1->Close();
}
bool __fastcall TForm1::ExecuteFile(String FileName)
{
AnsiString Path = ExtractFilePath( ParamStr(0) ) + "\\" + FileName;
int rc = (int) ShellExecute( Application->Handle, "open", Path.c_str(), NULL, NULL, SW_SHOWDEFAULT ) ;
if ( rc <= 32 )
{
MemoNews->Lines->Add("Errore di autoaggiornamento numero : " + AnsiString(rc));
return false;
}
return true;
}
Thank you very much
Alfred
Technical Details
Message-ID:
<4383d048$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9d517b38f0628b82,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Alfred" <alf@no.spam.not.valid.email> Sender: "Alfred" <alf@no.spam.not.valid.email> Reply-To: "Alfred" <alf@no.spam.not.valid.email> Subject: closing form Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 82.52.159.130 NNTP-Posting-Host: 207.105.83.66 Message-ID: <4383d048$1@newsgroups.borland.com> Date: 22 Nov 2005 18:13:28 -0700 X-Trace: newsgroups.borland.com 1132712008 207.105.83.66 (22 Nov 2005 18:13:28 -0700) Lines: 27 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail