Note that there are some explanatory texts on larger screens.

plurals
  1. POPreventing multiple instances - but also handle the command line parameters?
    primarykey
    data
    text
    <p>I am handling from my Application associated extension files from Windows. So when you double click a file from Windows it will execute my program, and I handle the file from there, something like:</p> <pre><code>procedure TMainForm.FormCreate(Sender: TObject); var i: Integer; begin for i := 0 to ParamCount -1 do begin if SameText(ExtractFileExt(ParamStr(i)), '.ext1') then begin // handle my file.. // break if needed end else if SameText(ExtractFileExt(ParamStr(i)), '.ext2') then begin // handle my file.. // break if needed end else end; end; </code></pre> <p>That works pretty much how I want it to, but when I was testing I realised it does not consider using only one instance of my program.</p> <p>So for example, if I selected several Files from Windows and opened them all at the same time, this will create the same number of instances of my program with the number of Files being opened.</p> <p>What would be a good way to approach this, so that instead of several instances of my program being opened, any additional Files from Windows being opened will simply focus back to the one and only instance, and I handle the Files as normal?</p> <p>Thanks</p> <p><strong>UPDATE</strong></p> <p>I found a good article here: <a href="http://www.delphidabbler.com/articles?article=13&amp;part=2" rel="noreferrer">http://www.delphidabbler.com/articles?article=13&amp;part=2</a> which I think is what I need, and shows how to work with the Windows API as mentioned by rhooligan. I am going to read through it now..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload