How to get the parent proccess's path
-
I want to run an application (see child) so that it can get the path of the current process (see parent). How?
Thank you masters!
-
I want to run an application (see child) so that it can get the path of the current process (see parent). How?
Thank you masters!
Your question is a little unclear. Why not simply pass the path to the process on the command line?
Steve
-
I want to run an application (see child) so that it can get the path of the current process (see parent). How?
Thank you masters!
Are you looking for GetModuleFileName Function? You can get the path of the executable file of the current process using above function. Sample code:
TCHAR szBuff[512];
GetModuleFileName(0, szBuff, 512);-- "Programming is an art that fights back!"
-
I want to run an application (see child) so that it can get the path of the current process (see parent). How?
Thank you masters!
Well, I would use GetModuleFileName() in the Parent process, and stuff it into the Environment of the Child Process:- PARENTPROCESS=C:\Program Files\etc... The Child Process can then queery the Environment, to get the Paren Process Name back. :)
Bram van Kampen
-
Well, I would use GetModuleFileName() in the Parent process, and stuff it into the Environment of the Child Process:- PARENTPROCESS=C:\Program Files\etc... The Child Process can then queery the Environment, to get the Paren Process Name back. :)
Bram van Kampen
Well you can use getcurrentdirectory to get the directory where the application was executed only if the parent process haven't changed that.
-
Well you can use getcurrentdirectory to get the directory where the application was executed only if the parent process haven't changed that.
raja jamwal wrote:
Well you can use getcurrentdirectory to get the directory where the application was executed only if the parent process haven't changed that.
No, Not Realy. getcurrentdirectory does exactly what it says. That is not nescessarily the same dir as where the exe is located. That's why I use GetModuleFileName(); :)
Bram van Kampen
-
raja jamwal wrote:
Well you can use getcurrentdirectory to get the directory where the application was executed only if the parent process haven't changed that.
No, Not Realy. getcurrentdirectory does exactly what it says. That is not nescessarily the same dir as where the exe is located. That's why I use GetModuleFileName(); :)
Bram van Kampen
yeah i know, the current directory variable attached with the module can be changed.
-
yeah i know, the current directory variable attached with the module can be changed.
Amen :)
Bram van Kampen