I have one EXE file i want that it should only run by one specific appliation like when APP2 try to run APP1 only then it run. i don't want to use command line argument string is there anything else?
Printable View
I have one EXE file i want that it should only run by one specific appliation like when APP2 try to run APP1 only then it run. i don't want to use command line argument string is there anything else?
In your Form_load event you would have to do a few things:
Detect if App1 is running by checking the task manager (process list)
or/and
Use the FindWindow API to detect if App1 is running
What is Conditional Compilation? can i use that?
How can i find the name and path of the calling EXE
i dont know of a way to detect the calling app in windows, but if you write a dos batch file that runs your app, and have the 2nd exe call that batch, you can get the caller using %0.
if you want to know if app one is already running, use App.PrevInstance - true if already running, false if not.
oh, although you said you didn't want command line arguments, it would work to have app2 pass its PID as an argument to App1, then in app1, check the processes name associated with that PID, and if it matches what you want, continue... that way, nobosy could spoof it. also might try passing a key via the clipboard or a temp file, or a registry key.