Shell doesnt give long filename
-
Im trying to setup my app so that when a user right clicks on a associated file type then selects "run with myApp" itll open my app passing the files full path. Ive tried getCommandLine() and directly accessing m_lpCmdLine but both of these return the short file name.
-
Im trying to setup my app so that when a user right clicks on a associated file type then selects "run with myApp" itll open my app passing the files full path. Ive tried getCommandLine() and directly accessing m_lpCmdLine but both of these return the short file name.
-
I'm not certain how do do exactly what you want, but couldn't you call GetLongPathName function once you know the short filename and convert it to the long name?
Unless he's calling a "short file name" just the "file name" as in x.exe. I've seen this that sometimes you get a full path in the command line and sometimes you just get the exe name. If you want to get the path to the current executable, which is what you want? You don't want to trust the command line. To get the path to the location of the exectuable (or DLL) use "GetModuleFileName" or "GetModuleFileNameEx". Those should get you the path to the executable.
-
I'm not certain how do do exactly what you want, but couldn't you call GetLongPathName function once you know the short filename and convert it to the long name?
Thank you very much! GetLongPathName was exactly what i needed. Just out of curiosity, do you have any idea why id be getting a short filename? I manually setup the registry so that when someone right clicked on the file type it ran my program and passed the file as a parameter. Whenever my program would get the command line data itd be in the form: and by short path i mean the old school dos type w/ ~'s in the path
-
Thank you very much! GetLongPathName was exactly what i needed. Just out of curiosity, do you have any idea why id be getting a short filename? I manually setup the registry so that when someone right clicked on the file type it ran my program and passed the file as a parameter. Whenever my program would get the command line data itd be in the form: and by short path i mean the old school dos type w/ ~'s in the path
Glad the workaround worked for you. I'm sorry I don't know the proper way to do this...I haven't done any shell programming at all. I did find this article on the codeguru; not that I recommend or endorse the codeguru in any way - seeing that I'm a loyal codeproject user: http://www.codeguru.com/Cpp/COM-Tech/shell/article.php/c1315/