Firstly, I would like to say that I don’t mean the full path, what
GetModuleFileName or argv[0] yield. Is there a smarter solution than dismissing everything before the last backslash?
Firstly, I would like to say that I don’t mean the full path, what
Share
First of all you want to get hold of the full path to the executable by calling
GetModuleFileNamepassingNULLas the module handle. Then callPathFindFileNameto pull out the file name component.There is in fact a difference between
GetModuleFileNameandargv[0]. The latter is the name used to start the process. It could be missing the full path, but more importantly here, it could be missing the.exeextension. If you want to know the actual filename then you need to useGetModuleFileName.