PDA

View Full Version : File Association - argument problem



NewsArchive
05-30-2008, 01:26 AM
Hi Friedrich,

Guess I'll have to continue the argument<g>

I've run into a problem again with the argument option for the file
association.

I changed my program to accept "%1" as the first parameter and that
would contain the filename. No problems but now I need to add a
SECOND argument to the command line in the file association. So I
added %2 to the "Arguments" field, thinking this would get me the "%1"
%2 that I needed. But this gets created into the registry as:

"C:\Program Files..." %2 "%1"

I.e. the entered arguments are placed BEFORE the default "%1"
argument.

When I use the shell to create a shortcut it places the arguments at
the END of the command line, like:

"Myproject.aprj" /E

If I change the association to "%1" %2 everything works fine with my
shortcuts as it should.

So it seems that I'm hosed doing this unless I modify the registry
key.

I'm using the IShellLink to create the shortcut:

psl->SetPath(lpszPathObj);
psl->SetDescription(lpszDesc);
if(lpszArg!=NULL){
psl->SetArguments(lpszArg);
}

and this is working without problems, but the SetArguments() places
any additional arguments after the SetPath() value.
Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
05-30-2008, 01:30 AM
Hi Arnór,

In the following:

"C:\VisualStudioPath\Common7\IDE\devenv.exe" /dde "%1"

the "argument" part would be /dde

The "%1" Windows variable is set automatically.

Friedrich

NewsArchive
05-30-2008, 01:31 AM
Hi Friedrich,

>"C:\VisualStudioPath\Common7\IDE\devenv.exe" /dde "%1"
>
>the "argument" part would be /dde
>
>The "%1" Windows variable is set automatically.

Hmm.... This contradicts the way the iShellLink creates the shortcut
link which feeds into the parameters. When I specify an argument with
the SetArgument, it is placed AFTER the filename, i.e. in this case:

"filename" /dde

See http://msdn.microsoft.com/en-us/library/bb774954(VS.85).aspx

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php