Mega Code Archive

 
Categories / Delphi / Files
 

Activate a Running Instance of an Application when a User Opens an Associated File by Extension

Title: Activate a Running Instance of an Application when a User Opens an Associated File by Extension If you have registered your own file type (extension) for an application, you can tell Windows to start your application when a user double clicks the file (or selects "Open" from the context popup menu) in the Windows Explorer. The ParamStr can be used to get the file(s) being processed. A side efect of a user selecting (double clicking) more than one file is that Windows will start as many instances of your application as there are files being "selected". In most situations, you will want only one instance of your application to open all the files being processed. If this is the case, you need the following handled: Run your Application by Double-Clicking on a File (Register Extension) Make sure only one instance of your application is allowed Send data (file path) to the running instance