Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.Diagnostics.Process.Start
Message
From
13/04/2012 12:39:19
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
System.Diagnostics.Process.Start
Miscellaneous
Thread ID:
01541444
Message ID:
01541444
Views:
71
Hello All.

This one is driving me crazy (yes, I know that it is a short drive).

I am using the following code to do a print screen and display it. It works just fine on my Wondows XP machine. The goofy thing is that on Windows 7 machines, it launches the process, displays the image and then immediately displays an error on this line:

oImageViewer.WaitForExit(-1);

because, indeed, oImageViewer is null. What's up with this and how do I fix it?
        private void cmdPrintScreen_Click(object sender, EventArgs e)
        {
            string File_nme = PrintScreen();
            if (File_nme != "")
            {
                try
                {
                    using (System.Diagnostics.Process oImageViewer = System.Diagnostics.Process.Start(@File_nme))
                    {
                        oImageViewer.WaitForExit(-1);
                    }
                }
                catch (Exception Ex)
                {
                    MessageForm.ShowMessage("Screen print failed", String.Format("Unable to print the screen because{0}{1}", Environment.NewLine, Ex.Message),
                        "", MessageFunction.OK, MessagingIcon.Information, MessagingSounds.None);
                }
                finally
                {
                    File.Delete(File_nme);
                }
            }
        }
Next
Reply
Map
View

Click here to load this message in the networking platform