๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ParamStr() extraction

#12777
From: Remy Lebeau (TeamB)
Date: Mon, 17 Nov 2003 17:50
32 lines
2389 bytes
"Conny H๏ฟฝkansson" <conny@allimac.se> wrote in message
news:3fb8a238@newsgroups.borland.com...

> A question on the Application->ExeName vs ParamStr(0)

Both return the exact same value.  In fact, the ExeName property simply
calls ParamStr(0) internally, so ParamStr(0) is doing all of the actual
work.

> could you give a real-life example when i would use the
> Application->ExeName rather than the ParamStr() or vice-versa?

When specifying 0 to ParamStr(), the two are interchangable, you can use
either one.  The only time you would ever need to call ParamStr(0) directly
would be if you don't have access to the global TApplication object, such as
in a standalone unit that you don't want to include the overhead of the
"Forms" unit into if you are not doing forms-related work in that unit.  But
other than that, the global TApplication object is usually always available,
so just use that whenever possible.

Not to mention that it just makes the code more clear as to what exactly it
is trying to do - obtain the filename of the application.  If you (or
someone reading your code) did not know what ParamStr() was, that intent
wouldn't be so clear unless you wrote comments for it.

> Does it have to do with were the application i launched or what?

No.


Gambit
Technical Details
Message-ID: <3fb90988@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.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: <3fb7fde1@newsgroups.borland.com> <3fb80881$1@newsgroups.borland.com> <3fb80d2c@newsgroups.borland.com> <3fb81ad3$1@newsgroups.borland.com> <3fb81b63$1@newsgroups.borland.com> <3fb8a238@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,470da9c3a4dba621
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-17 10:10:06 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fb7fde1@newsgroups.borland.com> <3fb80881$1@newsgroups.borland.com> <3fb80d2c@newsgroups.borland.com> <3fb81ad3$1@newsgroups.borland.com> <3fb81b63$1@newsgroups.borland.com> <3fb8a238@newsgroups.borland.com>
Subject: Re: ParamStr() extraction
Date: Mon, 17 Nov 2003 09:50:27 -0800
Lines: 34
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: 67.22.137.149
Message-ID: <3fb90988@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1069091208 67.22.137.149 (17 Nov 2003 09:46:48 -0700)
Path: arc1-ca.pugleaf.net!archiver1.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