Creating an Associator - How to enable the application to load the file that has been clicked
(Page 3 of 4 )
When an application starts, it has certain variables at its disposal. One of them is ParamStr();. "ParamStr(n)" is a global variable that contains various pieces of information in the following order:
ParamStr(0) = The current application name and path
ParamStr(1) = The file name that the user clicked on in Explorer or passed through the command line.
We are interested in ParamStr(1) since it will contain the parameters that the user passed to the application. So to check whether this variable contains something:
Var
Applicationname,Avariable:string;
begin
ApplicationName := ParamStr(0);
If ParamCount = 1 then AVariable := ParamStr(1);
...
//Use AVariable for whatever purpose you want to.....
End;
Make sure to add the above code to your applications' OnCreate event, and it will be able to start if a file that it is associated to is passed.
Next: The entire code >>
More Delphi-Kylix Articles
More By Jacques Noah