ShellExecute Problem bei W2k

Rando

Mitglied
Moin allerseits,

folgendes Problem! Ich habe ein kommerzielles Software Protection System zum Schutz für eine meiner Exen benutzt. Ich kann im Aktivierungsdialog des Softwareschutzes einen Button individuell konfigurieren, der beim drücken via ShellExecute (soviel weiß ich vom TechSupport des Herstellers) dann eine weitere Exe aufruft. Soweit so gut. Die Exe ist sehr unspektakulär gestrickt und verweist ihrerseits auf 3 HTML Links, die nun nach einem Klicken die entsprechende HTML-Seiten im StandardBrowser aufrufen sollen.

NUN ZUM PROBLEM:
Wenn die exe unter W2k über den Activation Dialog aufgerufen wird, startet sie, aber ein Anklicken der Links führt zu einer Exception (s. nächster Absatz)

************** Ausnametext **************
System.ComponentModel.Win32Exception: Das System kann die angegebene Datei nicht finden
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at Activate.exe.Form1.linkLabel1_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
at System.Windows.Forms.LinkLabel.OnLinkClicked(LinkLabelLinkClickedEventArgs e)
at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.LinkLabel.WndProc(Message& msg)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Wird die exe manuell gestartet funktionieren die Links problemlos. Ich hänge hier den Quellcode der Exe mal an. Ich denke es ist ein W2k spezifisches Problem, konnte aber im Netz keine Lösung dafür finden. Vielleicht kennt hier einer das Problem und weiss Rat.

Hier der Quellcode:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Activate.exe
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.LinkLabel linkLabel2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.LinkLabel linkLabel3;
public string [] command;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private string language_flag="en";
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1(string [] param)
{
//
// Required for Windows Form Designer support
//
SetString(param);
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.label3 = new System.Windows.Forms.Label();
this.linkLabel3 = new System.Windows.Forms.LinkLabel();
this.label4 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// linkLabel1
//
this.linkLabel1.Location = new System.Drawing.Point(16, 64);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(256, 24);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Activate your software";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(8, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(240, 16);
this.label1.TabIndex = 1;
this.label1.Text = "If you want to activate follow the link below";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(56, 224);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(184, 24);
this.button1.TabIndex = 2;
this.button1.Text = "Close";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label2.Location = new System.Drawing.Point(8, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(272, 24);
this.label2.TabIndex = 3;
this.label2.Text = "To visit the infopaxx homepage follow the Link below";
//
// linkLabel2
//
this.linkLabel2.Location = new System.Drawing.Point(16, 128);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(72, 24);
this.linkLabel2.TabIndex = 4;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "Homepage";
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label3.Location = new System.Drawing.Point(8, 168);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(248, 16);
this.label3.TabIndex = 5;
this.label3.Text = "To buy visit our online shop";
//
// linkLabel3
//
this.linkLabel3.Location = new System.Drawing.Point(16, 192);
this.linkLabel3.Name = "linkLabel3";
this.linkLabel3.Size = new System.Drawing.Size(248, 16);
this.linkLabel3.TabIndex = 6;
this.linkLabel3.TabStop = true;
this.linkLabel3.Text = "infopaxx online shop";
this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
//
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label4.Location = new System.Drawing.Point(8, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(104, 16);
this.label4.TabIndex = 7;
this.label4.Text = "Choose Language";
//
// button2
//
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
this.button2.Location = new System.Drawing.Point(128, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(32, 24);
this.button2.TabIndex = 8;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Image = ((System.Drawing.Image)(resources.GetObject("button3.Image")));
this.button3.Location = new System.Drawing.Point(168, 8);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(32, 24);
this.button3.TabIndex = 9;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.label4);
this.Controls.Add(this.linkLabel3);
this.Controls.Add(this.label3);
this.Controls.Add(this.linkLabel2);
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.linkLabel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "Activation Dialog";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string [] args)
{
Application.Run(new Form1(args));
}

public void SetString(string [] parameter)
{
command=parameter;
}

private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}

private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http:// Halt ein Link");
}

private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://www..com");
}

private void linkLabel3_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
if(language_flag=="en")
System.Diagnostics.Process.Start("http://");
else if(language_flag=="de")
System.Diagnostics.Process.Start("http://");
}

private void button2_Click(object sender, System.EventArgs e)
{
language_flag="de";
label4.Text="Sprache wählen";
label1.Text="Zur Aktivierung klicken Sie den Link";
linkLabel1.Text="Software Aktivierung";
label2.Text="Zum Besuch der Homepage klicken Sie den Link";
linkLabel2.Text="Homepage";
label3.Text="Um zu kaufen besuchen Sie den Shop";
linkLabel3.Text="online shop";
button1.Text="Schließen";
}

private void button3_Click(object sender, System.EventArgs e)
{
language_flag="en";
this.linkLabel1.Text = "Activate your software";
this.label1.Text = "If you want to activate follow the link below";
this.button1.Text = "Close";
this.label2.Text = "To visit the homepage follow the Link below";
this.linkLabel2.Text = "Homepage";
this.label4.Text = "Choose Language";
this.label3.Text = "To buy visit our online shop";
this.linkLabel3.Text = "online shop";
}
}
}


Thats it. Ich hoffe ihr könnt mir helfen... Danke schonmal

Gruß
 
Zuletzt bearbeitet:
Versuch doch mal beim Process.Start als ersten Parameter die iexplore.exe und als zweiten Parameter den Link anzugeben und ob es dann funktioniert.

Liebe Grüsse
Gregor
 
Leider hat das auch nichts geholfen. Ich habe im Netz recherchiert und es scheint eins der wenigen ungelösten Mysterien der Windows Welt zu sein.

Ich habe das Problem mittlererweile per ExceptionHandling abgefangen und dem Benutzer andere Optionen eingeräumt, die das Problem halt nicht lösen, aber umgehen.

Das tuts erstmal.

Danke und Gruß
 
Zurück