[C#] Sanduhr entfernen?!

Dieses Thema im Forum "Programmierung & Entwicklung" wurde erstellt von Mr.Gorillaz, 26. Juli 2010 .

Schlagworte:
  1. 26. Juli 2010
    Sanduhr entfernen?!

    Hallo,

    Habe mir ein kleines tool zusammengeschrieben, dass mir Batchdateien über eine GUI ausführt.
    Sobald ich jedoch mit der Maus über das Fenster gehe, ist dort ne Sanduhr zu sehen.
    Wie bekomme ich diese weg?

    Hier ist mal mein Code:
    Spoiler
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsFormsApplication1
    {
    public partial class Form1 : Form
    {

    string benutzer;
    string password;
    string computer;


    System.Diagnostics.Process p = new System.Diagnostics.Process();


    public Form1()
    {
    InitializeComponent();
    }

    // Übergabe der Werte in den Textfeldern
    //Computer
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
    computer = textBox1.Text;
    }


    //Benutzer
    private void textBox2_TextChanged(object sender, EventArgs e)
    {
    benutzer = textBox2.Text;
    }
    //Passwort
    private void textBox3_TextChanged(object sender, EventArgs e)
    {
    textBox3.PasswordChar = '*';
    password = textBox3.Text;
    }

    //Opsi Server Neustarten
    private void button1_Click(object sender, EventArgs e)
    {

    p.StartInfo.FileName = "ReOpsi.bat";
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    p.StartInfo.Arguments = " "+computer+ " " + benutzer + " " + password ;
    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();

    }

    //VNC-Starten
    private void button2_Click(object sender, EventArgs e)
    {
    p.StartInfo.FileName = "VNC_Starten.bat";


    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();

    }

    private void Remotedesktop_Click(object sender, EventArgs e)
    {
    p.StartInfo.FileName = "Remote_Desktop.bat";
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    p.StartInfo.Arguments = " " + computer + " " + benutzer + " " + password;
    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();
    }

    private void Openaudit_Click(object sender, EventArgs e)
    {
    p.StartInfo.FileName = "openauditopen.bat";
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();
    }

    private void UltraVNC_Click(object sender, EventArgs e)
    {
    p.StartInfo.FileName = "ultravnc.bat";
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    p.StartInfo.Arguments = " " + computer + " " + benutzer + " " + password;
    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();

    }

    private void OpenOpsi_Click(object sender, EventArgs e)
    {
    p.StartInfo.FileName = "opsiopen.bat";
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

    p.StartInfo.WorkingDirectory = @"c:\admintools\";
    p.Start();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }



    }
    }
     
  2. 26. Juli 2010
    AW: Sanduhr entfernen?!

    Komisch, normalerweise erscheint dann keine Sanduhr, da der Prozess asynchron gestartet wird und der Mainthread nicht auf die Ausführung wartet.

    Ich habs so getestet:
    Code:
    private Process p = new Process();
    
     private void button1_Click(object sender, EventArgs e)
     {
     this.p.StartInfo.FileName = @"C:\<kompletter Pfad zur .bat>\test.bat";
     this.p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     this.p.Start();
     }
    Pack einfach den kompletten Pfad in das FileName Attribut, aber ändere nicht das WorkingDirectory Attribut, da dieses für die .bats sicher noch benötigt wird.

    greez
     
  3. 26. Juli 2010
    AW: Sanduhr entfernen?!

    Kann man das nicht über die Form-Properties einstellen (sofern du von einem Form gesprochen hast)? Dort müsste man dann ein transparentes Symbol setzen. Habe gerade leider keine Zeit zum testen.
     
  4. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.