[Quiet Delphi] double-click the project file to open the software

Source: Internet
Author: User
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;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.