sandfish
Goto Top

Probleme mit Windows-GUI mit dem Öffnen von Dateien

Schonmal vielen dank für die Hilfe bei dem ADM-Templates, jetzt habe ich mal eine Frage aus dem Bereich WIndows-Programmierung in C++ an euch.

Ich habe den Auftrag bekommen, bei einem WIndows Server 2003 Englisch eine DHCP-Konfigurationsdatei von einem deutschen Windows 2000-DHCP-Server zu importieren.
Leider treten dabei Fehler auf. Entweder importiert der Rechner garnicht- oder es fehlt das "Optionvalue 43".
Es gibt nun die Möglichkeit, eine bestehende WIn2k3-DHCP-Konfigurationsdatei mit den Informationen des Win2K-DHCPs zu füttern.

Dazu wollte ich ein C++ Programm in "Visual C++ Express 2008" schreiben, was diese Aufgabe erfüllt. Leider habe ich bisher nur Erfahrung mit C++ in der Konsole.
Das Erstellen der GUI hat gut funktioniert.

So sieht sie aus:
80fb84135a5c5f554b289b8d5079b4ed-dhcp_database_importer

Nun möchte ich gerne, dass wenn ich auf das erste "Durchsuchen" klicke ein Kontextmenü geöffnet wird, mit dem Dateien geöffnet werden können.
Ich habe dazu: hxxp:msdn.microsoft.com/de-de/library/61097ykx(VS.80).aspx zur Hilfe genommen.

Jedoch gibt mein Programm Fehler aus und lässt sich nicht kompilieren.
Die Fehler sind:

Erstellen gestartet: Projekt: DHCP_database_importer, Konfiguration: Debug Win32 ------
Kompilieren...
DHCP_database_importer.cpp
.\DHCP_database_importer.cpp(6) : error C2143: Syntaxfehler: Es fehlt ';' vor 'using'
m:\visual studio 2008\projects\dhcp_database_importer\dhcp_database_importer\Form1.h(509) : error C2039: 'OK': Ist kein Element von 'System::Windows::Forms::Form::DialogResult'
m:\visual studio 2008\projects\dhcp_database_importer\dhcp_database_importer\Form1.h(23): Siehe Deklaration von 'System::Windows::Forms::Form::DialogResult'
m:\visual studio 2008\projects\dhcp_database_importer\dhcp_database_importer\Form1.h(509) : error C2065: 'OK': nichtdeklarierter Bezeichner
m:\visual studio 2008\projects\dhcp_database_importer\dhcp_database_importer\Form1.h(514) : error C2061: Syntaxfehler: Bezeichner 'System'
.\DHCP_database_importer.cpp(21) : fatal error C1075: Dateiende erreicht, bevor das zugehörige Element für das linke Element Klammer "{" in "m:\visual studio 2008\projects\dhcp_database_importer\dhcp_database_importer\Form1.h(4)" gefunden wurde
Das Buildprotokoll wurde unter "file:
m:\Visual Studio 2008\Projects\DHCP_database_importer\DHCP_database_importer\Debug\BuildLog.htm" gespeichert.
DHCP_database_importer - 5 Fehler, 0 Warnung(en)
Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========


Ich habe das Beispiel von Microsoft noch nicht abgeändert, also nicht wundern.
Hier der Quelltext:

#pragma once


namespace DHCP_database_importer {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/ <summary>
/ Zusammenfassung für Form1
/
/ Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
/ die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter Ressourcen ändern,
/ das allen RESX-Dateien zugewiesen ist, von denen diese Klasse abhängt.
/ Anderenfalls können die Designer nicht korrekt mit den lokalisierten Ressourcen
/ arbeiten, die diesem Formular zugewiesen sind.
/ </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();

TODO: Konstruktorcode hier hinzufügen.

}

protected:
/ <summary>
/ Verwendete Ressourcen bereinigen.
/ </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::GroupBox^ groupBox2;
private: System::Windows::Forms::GroupBox^ groupBox3;
private: System::Windows::Forms::RadioButton^ radioButton3;
private: System::Windows::Forms::RadioButton^ radioButton2;
private: System::Windows::Forms::RadioButton^ radioButton1;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::GroupBox^ groupBox4;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^ textBox7;
private: System::Windows::Forms::Label^ label8;
private: System::Windows::Forms::TextBox^ textBox6;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::TextBox^ textBox5;
private: System::Windows::Forms::GroupBox^ groupBox5;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::Label^ label11;
private: System::Windows::Forms::Label^ label10;
private: System::Windows::Forms::Label^ label12;
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;


protected:

private:
/ <summary>
/ Erforderliche Designervariable.
/ </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/ <summary>
/ Erforderliche Methode für die Designerunterstützung.
/ Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/ </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label3 = (gcnew System::Windows::Forms::Label());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->label4 = (gcnew System::Windows::Forms::Label());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
this->groupBox3 = (gcnew System::Windows::Forms::GroupBox());
this->textBox7 = (gcnew System::Windows::Forms::TextBox());
this->label8 = (gcnew System::Windows::Forms::Label());
this->textBox6 = (gcnew System::Windows::Forms::TextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
this->groupBox4 = (gcnew System::Windows::Forms::GroupBox());
this->button5 = (gcnew System::Windows::Forms::Button());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->groupBox5 = (gcnew System::Windows::Forms::GroupBox());
this->label12 = (gcnew System::Windows::Forms::Label());
this->label11 = (gcnew System::Windows::Forms::Label());
this->label10 = (gcnew System::Windows::Forms::Label());
this->label9 = (gcnew System::Windows::Forms::Label());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->groupBox1->SuspendLayout();
this->groupBox2->SuspendLayout();
this->groupBox3->SuspendLayout();
this->groupBox4->SuspendLayout();
this->groupBox5->SuspendLayout();
this->SuspendLayout();

label1

this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(3, 24);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(268, 13);
this->label1->TabIndex = 0;
this->label1->Text = L"Bitte geben Sie die Datenbank des Quell-Rechners ein.";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);

textBox1

this->textBox1->Location = System::Drawing::Point(278, 21);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(160, 20);
this->textBox1->TabIndex = 1;

button1

this->button1->Location = System::Drawing::Point(454, 19);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(86, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"Durchsuchen";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

label2

this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(3, 62);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(261, 13);
this->label2->TabIndex = 3;
this->label2->Text = L"Bitte geben Sie die Datenbank des Ziel-Rechners ein.";

textBox2

this->textBox2->Location = System::Drawing::Point(278, 59);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(160, 20);
this->textBox2->TabIndex = 4;

button2

this->button2->Location = System::Drawing::Point(454, 57);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(86, 23);
this->button2->TabIndex = 5;
this->button2->Text = L"Durchsuchen";
this->button2->UseVisualStyleBackColor = true;

label3

this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(40, 26);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(205, 13);
this->label3->TabIndex = 6;
this->label3->Text = L"Möchten Sie die Unterschiede speichern\?";

button3

this->button3->Enabled = false;
this->button3->Location = System::Drawing::Point(276, 19);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(86, 23);
this->button3->TabIndex = 7;
this->button3->Text = L"Ja";
this->button3->UseVisualStyleBackColor = true;

button4

this->button4->Enabled = false;
this->button4->Location = System::Drawing::Point(359, 19);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(86, 23);
this->button4->TabIndex = 8;
this->button4->Text = L"Nein";
this->button4->UseVisualStyleBackColor = true;

label4

this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(66, 21);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(73, 13);
this->label4->TabIndex = 9;
this->label4->Text = L"IP verwenden";

groupBox1

this->groupBox1->Controls->Add(this->button2);
this->groupBox1->Controls->Add(this->textBox2);
this->groupBox1->Controls->Add(this->label2);
this->groupBox1->Controls->Add(this->button1);
this->groupBox1->Controls->Add(this->textBox1);
this->groupBox1->Controls->Add(this->label1);
this->groupBox1->Location = System::Drawing::Point(9, 145);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(551, 101);
this->groupBox1->TabIndex = 10;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Datenbankauswahl";

groupBox2

this->groupBox2->Controls->Add(this->button4);
this->groupBox2->Controls->Add(this->button3);
this->groupBox2->Controls->Add(this->label3);
this->groupBox2->Location = System::Drawing::Point(9, 262);
this->groupBox2->Name = L"groupBox2";
this->groupBox2->Size = System::Drawing::Size(551, 54);
this->groupBox2->TabIndex = 11;
this->groupBox2->TabStop = false;
this->groupBox2->Text = L"Unterschiede";

groupBox3

this->groupBox3->Controls->Add(this->textBox7);
this->groupBox3->Controls->Add(this->label8);
this->groupBox3->Controls->Add(this->textBox6);
this->groupBox3->Controls->Add(this->label7);
this->groupBox3->Controls->Add(this->label5);
this->groupBox3->Controls->Add(this->textBox4);
this->groupBox3->Controls->Add(this->textBox3);
this->groupBox3->Controls->Add(this->radioButton3);
this->groupBox3->Controls->Add(this->radioButton2);
this->groupBox3->Controls->Add(this->radioButton1);
this->groupBox3->Controls->Add(this->label4);
this->groupBox3->Location = System::Drawing::Point(9, 333);
this->groupBox3->Name = L"groupBox3";
this->groupBox3->Size = System::Drawing::Size(551, 95);
this->groupBox3->TabIndex = 12;
this->groupBox3->TabStop = false;
this->groupBox3->Text = L"IP-Adresse in der neuen Konfigurationsdatei";

textBox7

this->textBox7->Enabled = false;
this->textBox7->Location = System::Drawing::Point(340, 62);
this->textBox7->Name = L"textBox7";
this->textBox7->Size = System::Drawing::Size(45, 20);
this->textBox7->TabIndex = 17;

label8

this->label8->AutoSize = true;
this->label8->Location = System::Drawing::Point(330, 69);
this->label8->Name = L"label8";
this->label8->Size = System::Drawing::Size(10, 13);
this->label8->TabIndex = 16;
this->label8->Text = L".";

textBox6

this->textBox6->Enabled = false;
this->textBox6->Location = System::Drawing::Point(285, 62);
this->textBox6->Name = L"textBox6";
this->textBox6->Size = System::Drawing::Size(45, 20);
this->textBox6->TabIndex = 15;

label7

this->label7->AutoSize = true;
this->label7->Location = System::Drawing::Point(275, 69);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(10, 13);
this->label7->TabIndex = 14;
this->label7->Text = L".";

label5

this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(220, 69);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(10, 13);
this->label5->TabIndex = 9;
this->label5->Text = L".";

textBox4

this->textBox4->Enabled = false;
this->textBox4->Location = System::Drawing::Point(230, 62);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(45, 20);
this->textBox4->TabIndex = 14;

textBox3

this->textBox3->Enabled = false;
this->textBox3->Location = System::Drawing::Point(175, 62);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(45, 20);
this->textBox3->TabIndex = 13;

radioButton3

this->radioButton3->AutoSize = true;
this->radioButton3->Enabled = false;
this->radioButton3->Location = System::Drawing::Point(155, 65);
this->radioButton3->Name = L"radioButton3";
this->radioButton3->Size = System::Drawing::Size(14, 13);
this->radioButton3->TabIndex = 12;
this->radioButton3->TabStop = true;
this->radioButton3->UseVisualStyleBackColor = true;

radioButton2

this->radioButton2->AutoSize = true;
this->radioButton2->Enabled = false;
this->radioButton2->Location = System::Drawing::Point(155, 42);
this->radioButton2->Name = L"radioButton2";
this->radioButton2->Size = System::Drawing::Size(138, 17);
this->radioButton2->TabIndex = 11;
this->radioButton2->TabStop = true;
this->radioButton2->Text = L"Von der Ziel-Datenbank";
this->radioButton2->UseVisualStyleBackColor = true;

radioButton1

this->radioButton1->AutoSize = true;
this->radioButton1->Enabled = false;
this->radioButton1->Location = System::Drawing::Point(155, 19);
this->radioButton1->Name = L"radioButton1";
this->radioButton1->Size = System::Drawing::Size(145, 17);
this->radioButton1->TabIndex = 10;
this->radioButton1->TabStop = true;
this->radioButton1->Text = L"Von der Quell-Datenbank";
this->radioButton1->UseVisualStyleBackColor = true;

groupBox4

this->groupBox4->Controls->Add(this->button5);
this->groupBox4->Controls->Add(this->textBox5);
this->groupBox4->Controls->Add(this->label6);
this->groupBox4->Location = System::Drawing::Point(9, 446);
this->groupBox4->Name = L"groupBox4";
this->groupBox4->RightToLeft = System::Windows::Forms::RightToLeft::No;
this->groupBox4->Size = System::Drawing::Size(551, 85);
this->groupBox4->TabIndex = 13;
this->groupBox4->TabStop = false;
this->groupBox4->Text = L"Neue Datenbank";

button5

this->button5->Enabled = false;
this->button5->Location = System::Drawing::Point(447, 34);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(86, 23);
this->button5->TabIndex = 6;
this->button5->Text = L"Durchsuchen";
this->button5->UseVisualStyleBackColor = true;

textBox5

this->textBox5->Enabled = false;
this->textBox5->Location = System::Drawing::Point(189, 36);
this->textBox5->Name = L"textBox5";
this->textBox5->Size = System::Drawing::Size(242, 20);
this->textBox5->TabIndex = 15;

label6

this->label6->AutoSize = true;
this->label6->Location = System::Drawing::Point(15, 39);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(168, 13);
this->label6->TabIndex = 14;
this->label6->Text = L"Neue Datenbank speichern unter:";

groupBox5

this->groupBox5->Controls->Add(this->label12);
this->groupBox5->Controls->Add(this->label11);
this->groupBox5->Controls->Add(this->label10);
this->groupBox5->Controls->Add(this->label9);
this->groupBox5->Location = System::Drawing::Point(9, 16);
this->groupBox5->Name = L"groupBox5";
this->groupBox5->Size = System::Drawing::Size(551, 114);
this->groupBox5->TabIndex = 14;
this->groupBox5->TabStop = false;
this->groupBox5->Text = L"Beschreibung";

label12

this->label12->AutoSize = true;
this->label12->Location = System::Drawing::Point(6, 90);
this->label12->Name = L"label12";
this->label12->Size = System::Drawing::Size(536, 13);
this->label12->TabIndex = 3;
this->label12->Text = L"Konfigurations-Datei des Zielrechners ein. Die Sprache der neuen Datei wird aus d"
L"er Zieldatenbank entnommen.";

label11

this->label11->AutoSize = true;
this->label11->Location = System::Drawing::Point(12, 69);
this->label11->Name = L"label11";
this->label11->Size = System::Drawing::Size(440, 13);
this->label11->TabIndex = 2;
this->label11->Text = L"Geben Sie dazu die zu importierende Datenbank des Quellrechners und eine vorhande"
L"nene";

label10

this->label10->AutoSize = true;
this->label10->Location = System::Drawing::Point(83, 47);
this->label10->Name = L"label10";
this->label10->Size = System::Drawing::Size(334, 13);
this->label10->TabIndex = 1;
this->label10->Text = L"sich nicht importieren lässt. (http://support.microsoft.com/kb/325473);;

label9

this->label9->AutoSize = true;
this->label9->Location = System::Drawing::Point(12, 25);
this->label9->Name = L"label9";
this->label9->Size = System::Drawing::Size(470, 13);
this->label9->TabIndex = 0;
this->label9->Text = L"Dieses Tool dient dazu, eine neue DHCP-Datenbank zu erstellen, falls die vorhande"
L"ne Datenbank";
this->label9->Click += gcnew System::EventHandler(this, &Form1::label9_Click);

openFileDialog1

this->openFileDialog1->FileName = L"openFileDialog1";

Form1

this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(561, 545);
this->Controls->Add(this->groupBox5);
this->Controls->Add(this->groupBox4);
this->Controls->Add(this->groupBox3);
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox1);
this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
this->Name = L"Form1";
this->Text = L"DHCP database Importer for Windows Server 2003";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->groupBox2->ResumeLayout(false);
this->groupBox2->PerformLayout();
this->groupBox3->ResumeLayout(false);
this->groupBox3->PerformLayout();
this->groupBox4->ResumeLayout(false);
this->groupBox4->PerformLayout();
this->groupBox5->ResumeLayout(false);
this->groupBox5->PerformLayout();
this->ResumeLayout(false);

}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label9_Click(System::Object^ sender, System::EventArgs^ e) {
}
private:
void button1_Click(System::Object ^ sender,
System::EventArgs ^ e)
{
Displays an OpenFileDialog so the user can select a Cursor.
OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog();
openFileDialog1->Filter = "Cursor Files|*.cur";
openFileDialog1->Title = "Select a Cursor File";

Show the Dialog.
If the user clicked OK in the dialog and
a .CUR file was selected, open it.
if (openFileDialog1->ShowDialog() == DialogResult::OK)
{
Assign the cursor in the Stream to
the Form's Cursor property.
this->Cursor = gcnew
System.Windows::Forms::Cursor(openFileDialog1->OpenFile());
}
};
}


Vielen Dank im Voraus

Content-Key: 109145

Url: https://administrator.de/contentid/109145

Printed on: April 24, 2024 at 08:04 o'clock

Member: Sandfish
Sandfish Feb 17, 2009 at 07:30:31 (UTC)
Goto Top
Kann mir mir keiner helfen face-sad - Oder habe ich das Problem irgendwie ungenau bschrieben?