Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
System.Diagnostics.Process.Start
Message
De
13/04/2012 12:39:19
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
System.Diagnostics.Process.Start
Divers
Thread ID:
01541444
Message ID:
01541444
Vues:
74
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);
                }
            }
        }
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform