Re: Parameters?
"Irwan" <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <[email protected]> |
use ParamStr() dan ParamCount --> read the online help
example (from Chami's Web Page)
function CmdLineParamFound(sParamName : String ) : Boolean;
const
// assume that command line parameters start with the "/" character
c_token = '/';
var
i : integer;
sTemp : string;
begin
result := False;
for i := 1 to ParamCount do
begin
sTemp := ParamStr( i );
if( c_token = sTemp[ 1 ] )then
begin
if( ( c_token +
UpperCase( sParamName ) ) =
UpperCase( sTemp ) )then
begin
result := True;
exit;
end;
end;
end;
end;
begin
{ following "if" statement will be triggered if called with the /HELP
parameter:
myprog.exe /HELP
}
if (CmdLineParamFound( 'HELP' )) then
begin
// display help here...
end;
// myprog.exe /FULLSCREEN
if (CmdLineParamFound( 'FULLSCREEN' )) then
begin
// run program in full screen mode
end;
end.
Irwan
-----Original Message-----
From: mail <[email protected]>
To: Eduardo Meyer <[email protected]>
Date: Thursday, July 10, 2003 5:56 PM
Subject: [Delphi] Parameters?
> Dear friends,
> How to transfer parameter into program (at opening)?
> For example - "winamp.exe /c:\doc\blabla.mp3".
>
>--
>Thanks,
>
>Vitaly Ivanyushin mailto:[email protected]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sOykFB/k9VGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->
Delphi Tips & Tutorials...
http://www.delphicollection.com
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/