Announcement

Collapse
No announcement yet.

CommandLine wirkungslos bei CreateProcess() !?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CommandLine wirkungslos bei CreateProcess() !?

    Hallo,

    hier mein Quelltext:
    <BR>
    -----------------<BR>
    public void StartIE(string <b>webaddress</b>){<BR><BR>
    const uint NORMAL_PRIORITY_CLASS = 0x0020;
    bool retValue;
    <BR>string Application = "C://Programme/Internet Explorer/IEXPLORE.exe";
    <BR>string <b>CommandLine = webaddress</b>;

    PROCESS_INFORMATION pInfo = new PROCESS_INFORMATION(); <BR>
    STARTUPINFO sInfo = new STARTUPINFO(); <BR>
    SECURITY_ATTRIBUTES pSec = new SECURITY_ATTRIBUTES();<BR>
    SECURITY_ATTRIBUTES tSec = new SECURITY_ATTRIBUTES();<BR>

    retValue = CreateProcess(Application,<b>CommandLine</b>,ref pSec,ref tSec,false,NORMAL_PRIORITY_CLASS,IntPtr.Zero,null, ref sInfo,out pInfo);
    <BR><BR>}//end_StartIE
    <BR>-----------------
    <BR>
    Der Browser wird zwar geöffnet, aber nicht mit der übergebenen URL! Was mache ich falsch?

    Danke i.V. und Gruß,
    ANDI
    <BR><BR><BR>
    <i>
    P.S. Über der Funktion steht natürlich folgendes:

    [DllImport("kernel32.dll")]

    static extern bool CreateProcess(string lpApplicationName,string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES lpThreadAttributes, bool bInheritHandles,uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory,[In] ref STARTUPINFO lpStartupInfo,out PROCESS_INFORMATION lpProcessInformation);</i>

  • #2
    Hallo,

    warum wird für diese Aufgabe nicht auf die <b>Process</b>-Klasse aus dem .NET Framework zurückgegriffen?

    <pre>
    System.Diagnostics.Process p = <b>new</b> System.Diagnostics.Process();
    p.StartInfo.FileName = <font color="#9933CC">&quot;IEXPLORE.exe&quot;</font>;
    p.StartInfo.Arguments = <font color="#9933CC">&quot;http://www.entwickler.com&quot;</font>;
    p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
    p.Start();
    p.WaitForExit();
    p.Close();
    MessageBox.Show (<font color="#9933CC">&quot;Internet Explorer wurde geschlossen.&quot;</font>);
    </pre&gt

    Comment

    Working...
    X