1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| private void button1_Click(object sender, EventArgs e)
{
string parametre_curl , path_image;
path_image = Application.StartupPath + " \\bin\\current.jpg";
parametre_curl = " -k -u admin:bechir -o " + path_image + " https://192.168.1.210:41250/cgi-bin/image.jpg?imgprof=QXGA";
// Instance de la classe Process
Process proc = new System.Diagnostics.Process();
// Nom de l'executable à lancer
proc.StartInfo.FileName = "curl.exe";
// Arguments à passer à l'exécutable à lancer
proc.StartInfo.Arguments = parametre_curl ;
//proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// Démarrage du processus
proc.Start();
//attente du processus
proc.WaitForExit();
pictureBox1.Image = Image.FromFile(path_image);
// On libère les ressources dont on n'a plus besoin.
proc.Close(); // Attention Close ne met pas fin au process
} |