473,508 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to open pictureBox.Image in Windows Picture and fax Viewer?

18 New Member
Hello, sorry for disturbing.
I have a pictureBox on my form. May i know how to open the image from the pictureBox in Windows Picture and Fax Viewer?


I've tried the code below, but it failed because the pictureBox1.Image is not in String format.

Expand|Select|Wrap|Line Numbers
  1. private void button1_Click(object sender, EventArgs e)
  2.         {            
  3.             Process p = new Process();
  4.  
  5.             p.StartInfo.FileName = "rundll32.exe";
  6.  
  7.             //Arguments 
  8.  
  9.             p.StartInfo.Arguments = @"C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen " + pictureBox1.Image;
  10.  
  11.  
  12.             p.Start();    
  13.         }
Is anyone can help?
Thanks in advance.

By, Aeris.
Apr 14 '10 #1
10 9606
tlhintoq
3,525 Recognized Expert Specialist
I think you've answered your own question. Fax and Picture Viewer opens files from a path. I don't know if it can be passed an Image object as an argument.

So if it requires a path, then you need to provide a path. Either the one used to get an Image *into* your PictureBox... or save the picture to a temp file on hard drive, then pass that path.
Apr 14 '10 #2
aeris
18 New Member
Thanks for replying. Let's say i had saved the image to a temp file, i want delete it automatically once the user click the close button on the Windows Picture and Fax Viewer.

May I know how to code to detect when a Close button is clicked?
something like
if (WindowsPictureFaxViewer.Close == selected)
{
//delete the picture
}
what is the proper coding to detect the close button?

Thanks in advance.
by, Aeris.
Apr 14 '10 #3
tlhintoq
3,525 Recognized Expert Specialist
You won't receive events from another program. You'll have to keep a thread going that is checking {in a loop] to see if the Fax & Picture Viewer process is still active. Once the process ends, then delete the temp file.

I notice that Windows Photo Viewer titles it's window with the photo file name. You could also keep checking to see if there is a window open with the file name. Once it no longer appears, then you can delete the temp file.
Apr 14 '10 #4
aeris
18 New Member
Thanks so much for replying.. May I know what is the code to check if the Windows Picture and Fax viewer process is not active?

Thanks in advance.
By Aeris.
Apr 14 '10 #5
tlhintoq
3,525 Recognized Expert Specialist
Amazing what one can find when actually reading the MSDN.
It looks like I was wrong about not getting an event when the process ends.
http://msdn.microsoft.com/en-us/libr...v=VS.100).aspx

SO using this technique you can get an event when the user quits Fax and Picture Viewer
Apr 14 '10 #6
GaryTexmo
1,501 Recognized Expert Top Contributor
Something else, I don't know how helpful it is... but here you go anyway!

If you'd prefer to use whatever viewer is associated to that file by default, I believe you can just attempt to run the image path. If there's a file association, the operating system should just launch it.
Apr 14 '10 #7
tlhintoq
3,525 Recognized Expert Specialist
If the OP does that, how will he detect *which* application has opened the image, and how will he detect when that application has closed, so he can delete the temp file?
Apr 14 '10 #8
GaryTexmo
1,501 Recognized Expert Top Contributor
I get knowing when the process that opened the image closes, but do they need to know what opened it? In reading the above I'm not sure if it matters, but I could easily be missing it.

It depends on if the process they generates with the image as the command line still generates the closed event. If so then they're fine but if not then yea, they're stuck using a specific program to open it.

I'm not sure how the process class treats that actually. Good point T, and I'm just curious enough to find out, but it'll have to wait until after lunch :D
Apr 14 '10 #9
GaryTexmo
1,501 Recognized Expert Top Contributor
You should be able to get everything you need to know launching it that way... I just confirmed that the event for the process existing does fire. You can also get the name of the process it launches with the ProcessName property.

Expand|Select|Wrap|Line Numbers
  1.     public partial class Form1 : Form
  2.     {
  3.         public Form1()
  4.         {
  5.             InitializeComponent();
  6.  
  7.             Process p = new Process();
  8.             p.StartInfo.FileName = @"C:\temp\click.wav";
  9.             p.EnableRaisingEvents = true;
  10.             p.Exited += new EventHandler(p_Exited);
  11.  
  12.             p.Start();
  13.             Console.WriteLine(p.ProcessName);
  14.         }
  15.  
  16.         void p_Exited(object sender, EventArgs e)
  17.         {
  18.             MessageBox.Show("Process Done!");
  19.         }
  20.     }
NOTE: I'm not saying it has to be done this way, just offering alternatives :)
Apr 14 '10 #10
aeris
18 New Member
Thanks you all!
Thanks for the coding.
I think I know what should do from all your opinions. Thanks so much.
By, Aeris. :)
Apr 15 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

8
31474
by: Pavan Arise | last post by:
Dear all.. I have a picturebox filled on a form. The picturebox has some graphics displayed on it.I was trying to save the picturebox, but continuesly failed to do so. I am clueless of why it is...
0
3863
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for...
3
63296
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
6
4729
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the...
3
3678
by: EnglishMan69 | last post by:
Hello All, I am using VB2005 Beta 2 in VS 2005 and am running into a small problem. I need to be able to add a picture box to the main form from within a thread. The program goes to a web...
5
10286
by: GoGs | last post by:
How this vb6 code convert in c# dotnet2 ----- Image1.Visible = False Image1.Picture = LoadPicture("c:\image008.jpg") Dim x, y As Single x = Image1.Width y = Image1.Height Do While x...
1
2178
by: Jeff Williams | last post by:
I have a picture (jpg) displaying in a picture box but I find that the file handle is still open to the image on disk. I think I need the following to happen 1. Load image from file on disk...
4
3687
by: Jim McGivney | last post by:
In C# on Form1 I genetate an array of PictureBoxes and populate each with an image as seen in the code below. Later on I want to access a specific PictureBox to change its image, but I keep...
1
3492
by: Rishi Boparai | last post by:
Hi, in Visual Studios there's this tool called PictureBox rite...but in Visual Web developer i can't seem to find it.. i'm using Visual Web Developer...VB language..to make a watermarking...
1
3445
by: sop23456 | last post by:
Microsoft Access 2003 I have hyperlink the image/picture to another file. When I click on the hyperlink, the image appears using MS Paint. What do I do to view Image/picture in Windows Picture...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.