open many files by right clicking

L

Lee

Hi,

I have created an application that i wish to launch after a file has
been right clicked, and then a menu item selected. For this i used a
registry tweak similar to this one for opening a command prompt;-

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Open Command Window Here"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k pushd %L"

but the one i have used operates on files rather than directories, I
also want this to happen when i select more than 1 file. At the
moment if i select more than 1 file a new version of the application
gets launched for each file. I would rather have 1 app version
launched but with the list of selected files passed to it. but i am a
bit stuck .... can anyone help me with this?

thanks in advance
lee
 
M

Mythran

Lee said:
Hi,

I have created an application that i wish to launch after a file has
been right clicked, and then a menu item selected. For this i used a
registry tweak similar to this one for opening a command prompt;-

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Open Command Window Here"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k pushd %L"

but the one i have used operates on files rather than directories, I
also want this to happen when i select more than 1 file. At the
moment if i select more than 1 file a new version of the application
gets launched for each file. I would rather have 1 app version
launched but with the list of selected files passed to it. but i am a
bit stuck .... can anyone help me with this?

thanks in advance
lee

Well, you can check for a command-line parameter and if there is currently
no instances of your application running, you can start your application as
normal. If there is an instance currently running and there is a
command-line parameter (filename being passed), you can pass the parameter
to the currently running instance for processing (maybe have a
drop-directory or something that gets checked...or have a windows message
sent to the application..<shrug> haven't needed to pass information to a
running instance...but it's the thought that counts ;P)

There might be a better way though, and that I am failing to see at this
time.

HTH,
Mythran
 
B

Ben Voigt [C++ MVP]

Mythran said:
Lee said:
Hi,

I have created an application that i wish to launch after a file has
been right clicked, and then a menu item selected. For this i used a
registry tweak similar to this one for opening a command prompt;-

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@="Open Command Window Here"
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command]
@="cmd.exe /k pushd %L"

but the one i have used operates on files rather than directories, I
also want this to happen when i select more than 1 file. At the
moment if i select more than 1 file a new version of the application
gets launched for each file. I would rather have 1 app version
launched but with the list of selected files passed to it. but i am
a bit stuck .... can anyone help me with this?

thanks in advance
lee

Well, you can check for a command-line parameter and if there is
currently no instances of your application running, you can start
your application as normal. If there is an instance currently
running and there is a command-line parameter (filename being
passed), you can pass the parameter to the currently running instance
for processing (maybe have a drop-directory or something that gets
checked...or have a windows message sent to the application..<shrug>
haven't needed to pass information to a running instance...but it's
the thought that counts ;P)
There might be a better way though, and that I am failing to see at
this time.

Create a mailslot... it returns whether you got a new one or opened an
existing one. If an existing one, stuff your command-line arguments in and
exit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top