Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
How do I get the Application name when user using explore openwith window and select an application to open the file.
For Example
When users right click a file in explore select openwith then open with window will appear from that select myapp.exe .
Then now is how from my c# application I get the Application name(ie application to which the file should open. here expected file name is myapp.exe).

Thanks in Advance.
Posted
Updated 20-Jun-11 18:53pm
v5
Comments
StM0n 20-Jun-11 5:33am    
Sorry, do you mean the clicked file?
Sergey Alexandrovich Kryukov 20-Jun-11 10:57am    
The solutions are so different because a question is not clear. For example, your application is player, player.exe, opened with command-line parameter, a file to play: player.exe myAudio.mp3. What do you want to get from you code, path name of "player.exe" or "myAudio.mp3? Or something else, a program associated with extension?
You don't have satisfactory answer so far, I think.
--SA

Change the Main static method of your program class (I'm assuming you are developing a GUI application) from
C#
static void Main()

to
C#
static void Main(string [] args)


and the check the arg[0] parameter value.
 
Share this answer
 
Comments
StM0n 20-Jun-11 6:11am    
You're too fast ;)
CPallini 20-Jun-11 6:19am    
:-D
There was no need to remove your answer, though.
StM0n 20-Jun-11 6:28am    
Yeah... was a little bit to quick to press delete :P
 
Share this answer
 
Comments
Venkatesh Mookkan 20-Jun-11 5:51am    
I get he is asking for Open a file using his application from Window Explorer like double clicking Word document opens in Word application
StM0n 20-Jun-11 6:08am    
Thought so... but I'm not quite sure...
try this link
C# FileAssociation Class[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900