29. oktober 2002 - 18:37Der er
9 kommentarer og 1 løsning
Association
Jeg HAR associeret en bestemt fil til en applikation, via Windows registreringsbase - Det virker ok!!!
Mit problem er at naar jeg saa dobbelt-klikker paa en fil i Windows Stifinder (som saa aabner min applikation), hvordan kan min applikation vide, hvilken fil der er blevet eksekveret? Skal jeg bruge en API kald???
Nej det er ikke et direkte apikald Taget fra hjælpen
The following example beeps once for each “beep” passed in on the command line. The example terminates the application if “exit” is passed in on the command line.
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer; for i := 1 to ParamCount do begin if LowerCase(ParamStr(i)) = 'beep' then Beep elseif LowerCase(ParamStr(i)) = 'exit' then Application.Terminate; end; end;
------------------
Returns a specified parameter from the command-line.
Unit
System
Category
command line utilities
function ParamStr(Index: Integer): string;
Description
ParamStr returns the parameter from the command line that corresponds to Index, or an empty string if Index is greater than ParamCount. For example, an Index value of 2 returns the second command-line parameter.
ParamStr(0) returns the path and file name of the executing program (for example, C:\TEST\MYPROG.EXE).
Note: Use double quotes to wrap multiple words as one parameter (such as long file names containing spaces).
mitprogram.exe "dette er et filnavn med mellemrum.txt"
"dette er et filnavn med mellemrum.txt" // dette er 1 parameter
dette er // det er 2 parameter
Stoney
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.