|
-
January 12th, 2010, 08:37 PM
#1
[RESOLVED] Reading a run parameter
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
-
January 13th, 2010, 04:10 AM
#2
Re: Reading a run parameter
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.
Victor Nijegorodov
-
January 13th, 2010, 05:37 AM
#3
Re: Reading a run parameter
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/
-
January 13th, 2010, 05:47 AM
#4
Re: Reading a run parameter
 Originally Posted by Barriebyrnes
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/
Please stop spamming Codeguru. Nobody cares about your project-drive.
-
January 13th, 2010, 09:12 AM
#5
Re: Reading a run parameter
 Originally Posted by VictorN
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.
Hi Victor,
That would give me the path to where my app is running from but what I want is the path to the directory that was right clicked upon.
Thanks
Zapper
-
January 13th, 2010, 09:20 AM
#6
Re: Reading a run parameter
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();
-
January 13th, 2010, 09:32 AM
#7
Re: Reading a run parameter
 Originally Posted by zapper222
I have my MFC app set to start whenever I right click on a folder and select "MyApp" from the menu ...
 Originally Posted by zapper222
Hi Victor,
That would give me the path to where my app is running from but what I want is the path to the directory that was right clicked upon...
1. What is the Application you make a "right click on a folder and select "MyApp" from the menu"? Is it Windows Explorer or some other?
2. What is the *menu* containing "MyApp" item? Who created it? Who and how handles it?
Victor Nijegorodov
-
January 13th, 2010, 05:58 PM
#8
Re: Reading a run parameter
=> 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
-
January 14th, 2010, 03:43 AM
#9
Re: Reading a run parameter
 Originally Posted by zapper222
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 ...
1. Again: What is the Application you make a "right click on a folder and select "MyApp" from the menu"? Is it Windows Explorer or some other?
2. Which "registry setting" did you modify and what for?
Victor Nijegorodov
-
January 14th, 2010, 08:32 AM
#10
Re: Reading a run parameter
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
-
January 14th, 2010, 08:58 AM
#11
Re: Reading a run parameter
 Originally Posted by zapper222
...
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 ?
Well, your explanation is very poor again... 
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
Victor Nijegorodov
-
January 14th, 2010, 08:30 PM
#12
Re: Reading a run parameter
It was a command line argument I was looking for and m_lpCmdLine was what I needed.
Thanks Victor !
Zapper
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|