Problem description
Most software can open the associated software and open the selected project by double-clicking the file. How does this happen?
Associate the file with a program and double-click the file to start the program. The file name is a parameter of the command line of the program..
To open the software by double-clicking the project file, you must process the command line at the program running portal.
Code Description
1 begin 2 application. initialize; 3 createmainform (); 4 // getcommandline is a Win32 API used to obtain the command line content 5 handlecommandline (Getcommandline); 6 if system. paramcount = 0 then 7 executeapplication (); 8 application. run; 9 end.10 11 procedure handlecommandline (const acommandline: string); 12 begin13 // Number of resolution parameters: No parameter, directly Exit 14 if paramcount (acommandline) = 0 Then exit; 15 16 S: = paramstr (acommandline, 1); 18 if isopenfilemode (s) then19 begin20 // determine whether the current project can be opened 21 if not appinmodelstate then22 openprojfile (getlongfilename (s) 23 else24 showprompt ('close the current form, double-click the project again. '); 25 end; 26 end;