?
Hallo,
ich bin relativ neu bei VC++, hab vorher immer in Dev-C++ programmiert.
Das erste Programm soll zuerst einmal nur eine URL auf Knopfdruck öffnen, bzw. später eine in einem Textfeld eingegebene URL öffnen soll. Jetzt bentze ich, wie in der MSDN-Library gefunden, den OpenApplication bzw. den OpenWithArguments.
Doch dann bekomme ich diese Fehlermeldungen:
Fehler 1 error C2601: 'OpenApplication': Lokale Funktionsdefinitionen sind unzulässig 111
Fehler 2 error C2601: 'OpenWithArguments': Lokale Funktionsdefinitionen sind unzulässig 115
Hier meine Header-Datei:
[#pragma once
#using <System.dll>
namespace SecondProject {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Diagnostics;
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::Button^ button1;
protected:
private: System::Windows::Forms::TextBox^ textBox1;
protected:
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)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(424, 86);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(89, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"URL besuchen";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(318, 88);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(100, 20);
this->textBox1->TabIndex = 1;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(601, 321);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e)
{
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
void OpenApplication()
{
Process::Start( "IExplore.exe" );
}
void OpenWithArguments()
{
Process::Start( "IExplore.exe", "www.meineurl.de" );
}
}
};
}
/cpp]
Und hier meine Projekt-Datei:
[cpp]// Second Project.cpp: Hauptprojektdatei.
#using <system.dll>
#include "stdafx.h"
#include "Form1.h"
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
using namespace SecondProject;
// Hiermit definiere ich OpenWithArguments
void OpenWithArguments(){};
void OpenApplication(){};
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Aktivieren visueller Effekte von Windows XP, bevor Steuerelemente erstellt werden
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Hauptfenster erstellen und ausführen
Application::Run(gcnew Form1());
OpenApplication();
OpenWithArguments();
return 0;
}
Zu diesen Fehlern fand ich in der MSDN-Library nicht genügend Informationen. Bitte um Hilfe.
P.S. Vielen Dank im Vorraus