I have my MFC app set to start whenever I right click on a folder and select "MyApp" from the menu. How do I get the name of the folder that I right clicked on to start my application?
Thanks
Zapper
Printable View
I have my MFC app set to start whenever I right click on a folder and select "MyApp" from the menu. How do I get the name of the folder that I right clicked on to start my application?
Thanks
Zapper
Use GetModuleFileName function which retrieves the full path and file name for the file containing your exe.
Use then PathRemoveFileSpec to obtain the folder path from the full path name.
Today, we are living in an era of the Internet where online project management software serves as a great tool to help us complete projects on time. Such software is the simplest tool that helps the project managers plan and manage different tasks that are involved in each project.
For more information about , visit on link: http://www.project-drive.net/
I'm not exactly sure what you mean by right clicking on a folder to start an app, but perhaps you're looking for GetCurrentDirectory();
=> GCDEF
No GetCurrentDirectory() doesn't work.
=>Victor
Think of it like when you want to search a directory, you right click on the directory, and select Search...
I have modified a registry setting so that when you right click on a folder my application is one of the menu items you can select. Now when my application starts I want the directory that the user right clicked upon.
Zapper
The application is an MFC dialog application that I wrote.
I want to identify the folder that was right clicked upon.
The entry in the registry just identifies the path to my application.
So what I have noticed in other registry entries such as notepad etc is that the path to notepad is provided and a variable is placed at the end that would identify the filename.
ie c:\windows\notepad.exe "%1"
So if I make my registry entry read:
c:\windows\mydir\myapp.exe "%1"
When my application starts where would I find the value of %1...where does an mfc dialog application store this when it starts up ?
Zapper
Well, your explanation is very poor again... :eek:
However, if you only want to get the value of "%1" parameter of the command line started your App then have a look at MFC class CCommandLineInfo or/and CWinApp::m_lpCmdLine member or/and GetCommandLine / CommandLineToArgvW Win32 API functions
It was a command line argument I was looking for and m_lpCmdLine was what I needed.
Thanks Victor !
Zapper