Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to open image/audio/video from the resource folder of the application
as a separate process

System.Diagnostics.Process.Start(@"WindowsFormsApplication2.Properties.Resources.photo");

please correct the above code and make it workable
Posted

Perhaps this will lead you in the right direction.

http://msdn.microsoft.com/en-us/library/aa287676(v=vs.71).aspx[^]
 
Share this answer
 
Comments
RaviRanjanKr 2-Jul-11 14:53pm    
Nice Link! My 5 :)
This thread[^] should help you out.
 
Share this answer
 
Comments
vishnulalr 2-Jul-11 12:37pm    
thanks Abinav but i want to open an image that stored inside the app as a resource file i cant specify the path please concentrate there
Sergey Alexandrovich Kryukov 2-Jul-11 20:39pm    
This is a different story! You never ask about it!

It depends where the player is. If it is inside your application, there is no problem -- you can play it through resource URI. If you want to use external player, I'm afraid all you can do is to create a temporary file and safe resource to that file, then use Process.Start to play it.

--SA
Sergey Alexandrovich Kryukov 2-Jul-11 20:40pm    
5 for this answer.

OP wants something very different. So, please see my comment to his answer above and my solution.
--SA
vishnulalr 2-Jul-11 21:58pm    
thanks you re wright please help me how can i write a resourcr url for image,video file for video here i am using directx audiovideoplayback.dll
your code is not correct because Start function need filename as a parameter which is not what you are passing so its taking as a invalid parameter.
you can use WindowsFormsApplication2.Properties.Resources.photo to assign value to pictureBox1.Image to display images in image control.
as
pictureBox1.Image = WindowsApplication2.Properties.Resources.photo;

This Link-[How to Use Resource File in C#][^] might help you. for further references.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 2-Jul-11 20:30pm    
Sorry Ravi, what you say is not correct. You can pass a data file instead of executable, if its extension has association with some "Open with" application in Registry.
--SA
You can actually do it if the file extension of your media file is registered in the system and has some "Open With" application. If usually happens when you install and/or configure appropriate failure.

The different thing is: you cannot use any hard-coded file names. There are no situations where it can be useful. Use, for example, an Open File dialog. I hope you put it in code just with the purpose of asking a question, or experimentally.

[EDIT: answering a follow-up question about a file embedded in resource]
Please see my comment to the solution by Abhinav.

—SA
 
Share this answer
 
v2

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