In a Delphi 10.4.2 win-32 VCL Application associated with graphic file formats in Windows 10, I get parameter files selected in Windows File Explorer. Here I watch the files passed to my app right after Application.Initialize;:
CodeSite.Send('AppInstances: ParamCount', ParamCount);
When I select ONE file in Explorer and then press the ENTER key, this file gets loaded in my application. So far so good.
But when I select THREE files in Explorer and then press the ENTER key, my app gets started THREE times each time with ONE of the 3 file parameters:
Is it possible that Explorer would start my app only ONCE and pass the 3 selected files at once to my app when I press the Enter key?

SUMMARY
In Registry put the target program as Context Menu Create File.exe which writes reg.txt file.
In your main program loop every 1 second to check if reg.txt exists. If it exists, kill the Context Menu Create File.exe and delete the reg.txt file. Then copy the selected file paths and manipulate with them.
If your program loops to check for reg.txt, then you need to start the program before executing context menu either on startup or manually.
INSTRUCTIONS:
Create 2 files in the same directory:
Create 1st program Add To Context Menu And Create Startup Shortcut.ahk
RunAsAdminLabel ensures that the script runs as admin (fixes adding Registry values).If (!A_IsAdmin)checks if current user is NOT admin, A_IsAdmin is a built in AutoHotkey variable that returns 1 if user is admin, 0 otherwise.Run, \*RunAs "%A_ScriptFullPath%"*RunAs parameter runs the script as admin, "%A_ScriptFullPath%" gets the full path of the current executing script.ExitAppexits the current script instance running without admin privileges.Runcommand runs the script again with admin privileges it will skip theIFcondition and continue executing code below.ContextMenuCreateFile:Label creates a Context Menu Create File.exe which creates a file reg.txt and exits Context Menu Create File.exe after it has written the file reg.txt. Make sure you specify where yourAhk2Exe.exepath is in theRunWaitcommand.Add To Context Menu:Label adds the Registry entry which runs Context Menu Create File.exe.contextMenuvariable to what needs to be displayed in the Context Menu. (Theprogramname is set tocontextMenu)regPathto your desired Registry path.MsgBox, check if the command is added to the Registry in the address bar.CreateStartupShortcut:Label creates the shortcut of the main program Open With Chrome.exe in Startup folder.Add To Context Menu And Create Startup Shortcut.ahk
Loopis created and checks every 1 second if reg.txt exists.IfExist, reg.txtit kills the Context Menu Create File.exe and deletes the reg.txt.If CLIPBOARD contains .,\to make sure CLIPBOARD contains path "\" with extension ".".selectedFilesvariable.chromeParams := ""loops through selected files, gets thefilePaths and surrounds them with double quotes, andStringReplacereplaces the Windows path as url file path ex:C:\path\file.jpgtofile:///path/file.jpg.filePathis concatenated tochromeParams.StringTrimRightremoves the last space fromchromeParamsstring.Run, chrome.exe %chromeParams%is executed with%chromeParams%(list of selected files). (If the command doesn't open Chrome then put full path to Chrome, ex:Run, C:\Program Files (x86)\Google\Chrome\Application\chrome.exewith the same parameters)Open With Chrome.ahk
Convert both Add To Context Menu And Create Startup Shortcut.ahk and Open With Chrome.ahk to EXE files in the same directory using Ahk2Exe.exe --> (find in Start Menu, just browse file and hit convert)
Execute the
Add To Context Menu And Create Startup Shortcut.exeSelect files, right click and the Open With Chrome context menu item should appear.