Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.Diagnostics.Process.Start
Message
From
13/04/2012 21:55:27
 
 
To
13/04/2012 12:39:19
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01541444
Message ID:
01541505
Views:
34
Do you need the oimageviewer? What if you just call it straight
try
{
System.Diagnostics.Process.Start(@File_nme);
}


>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);
>                }
>            }
>        }
>


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform