Probelm with Process and shortcut

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I directly go to the problem, I create a Process, I set the Filename to the
full path and filename of a shortcut file (.lnk) and then I start my process,
like this :

Process p;
p.StartInfo.FileName = "path\\of\\my\\shortcut\\file.lnk";
p.Start();

My problem is that I always get a Win32Exception, with this message :
"The specified executable is not a valid Win32 application"

My shortcut is valid, it links to a PDF file and when I double-click on my
shortcut, I get my PDF document open in Acrobat, properly

Thank you in advance for any help
 
Hello sebseb,

Try the following:

Process p;
p.StartInfo.FileName = "path\\of\\my\\shortcut\\file.lnk";
p.StartInfo.Verb="open";
p.Start();


Regards.


"sebseb" <[email protected]> escribió en el mensaje | Hello
|
| I directly go to the problem, I create a Process, I set the Filename to the
| full path and filename of a shortcut file (.lnk) and then I start my process,
| like this :
|
| Process p;
| p.StartInfo.FileName = "path\\of\\my\\shortcut\\file.lnk";
| p.Start();
|
| My problem is that I always get a Win32Exception, with this message :
| "The specified executable is not a valid Win32 application"
|
| My shortcut is valid, it links to a PDF file and when I double-click on my
| shortcut, I get my PDF document open in Acrobat, properly
|
| Thank you in advance for any help
 
Thank you for answering, but the result is same... still not work, and still
the same exception with the same message

The French version of this message could be a help, maybe, since it's bit
different from the English message, it says : "Aucune application n'est
associée au fichier spécifié pour cette opération" which means "There is no
application associated to this file for this operation"

The English equivalent was : "The specified executable is not a valid Win32
application"

I still need help, my whole project will be affected if I can't resolve it,
I can bypass by changing strategy, but it will but much much less useful for
end-users :S
 
Hello,

It works fine on my system. Have you tried it with different links or documents other than Acrobat Reader?

Regards.


"sebseb" <[email protected]> escribió en el mensaje | Thank you for answering, but the result is same... still not work, and still
| the same exception with the same message
|
| The French version of this message could be a help, maybe, since it's bit
| different from the English message, it says : "Aucune application n'est
| associée au fichier spécifié pour cette opération" which means "There is no
| application associated to this file for this operation"
|
| The English equivalent was : "The specified executable is not a valid Win32
| application"
|
| I still need help, my whole project will be affected if I can't resolve it,
| I can bypass by changing strategy, but it will but much much less useful for
| end-users :S
|
|
| "José Manuel Agüero" wrote:
|
| > Hello sebseb,
| >
| > Try the following:
| >
| > Process p;
| > p.StartInfo.FileName = "path\\of\\my\\shortcut\\file.lnk";
| > p.StartInfo.Verb="open";
| > p.Start();
| >
| >
| > Regards.
| >
| >
| > "sebseb" <[email protected]> escribió en el mensaje | > | Hello
| > |
| > | I directly go to the problem, I create a Process, I set the Filename to the
| > | full path and filename of a shortcut file (.lnk) and then I start my process,
| > | like this :
| > |
| > | Process p;
| > | p.StartInfo.FileName = "path\\of\\my\\shortcut\\file.lnk";
| > | p.Start();
| > |
| > | My problem is that I always get a Win32Exception, with this message :
| > | "The specified executable is not a valid Win32 application"
| > |
| > | My shortcut is valid, it links to a PDF file and when I double-click on my
| > | shortcut, I get my PDF document open in Acrobat, properly
| > |
| > | Thank you in advance for any help
 
I tried with almost all famous format like MP3, images, videos, exe, etc...
it seems to work on all other systems, and it works perfectly at work, I
tested to see...
so it's obviously a problem on my computer but I just expected that someone
would have encountered such a problem and could tell me how to resolve.

But it's ok, I straped the problem writing a basic .lnk parser which get the
executable filename, then at starting, I first try the execution via Process
method into a try/catch bloc, if it fails, I set a flag telling that the
program have to work with the lnk parsing, and if it doesn't, the program
works with Process method. That works pretty fine, just first time is slow in
my case because of the exception throwing.
 
Back
Top