Form will sich nicht zeigen
-
Hallo,
ich möchte eine zweite Windows-Form aus meiner ersten Form heraus aufrufen.#pragma once namespace Hook_Form { #include "stdafx.h" #include <windows.h> #include "..\Hook Dll\Hook.h" #include "FrmChild.h" 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> /// Summary for Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> //class FrmChild; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ install_button; private: System::Windows::Forms::Button^ uninstall_button; private: System::Windows::Forms::Button^ layer; protected: protected: private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma 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> void InitializeComponent(void) { this->install_button = (gcnew System::Windows::Forms::Button()); this->uninstall_button = (gcnew System::Windows::Forms::Button()); this->layer = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // install_button // this->install_button->Location = System::Drawing::Point(342, 92); this->install_button->Name = L"install_button"; this->install_button->Size = System::Drawing::Size(75, 23); this->install_button->TabIndex = 0; this->install_button->Text = L"Install"; this->install_button->UseVisualStyleBackColor = true; this->install_button->Click += gcnew System::EventHandler(this, &Form1::install_button_Click); // // uninstall_button // this->uninstall_button->Location = System::Drawing::Point(341, 154); this->uninstall_button->Name = L"uninstall_button"; this->uninstall_button->Size = System::Drawing::Size(75, 23); this->uninstall_button->TabIndex = 1; this->uninstall_button->Text = L"UnInstall"; this->uninstall_button->UseVisualStyleBackColor = true; this->uninstall_button->Click += gcnew System::EventHandler(this, &Form1::uninstall_button_Click); // // layer // this->layer->Location = System::Drawing::Point(645, 112); this->layer->Name = L"layer"; this->layer->Size = System::Drawing::Size(75, 23); this->layer->TabIndex = 2; this->layer->Text = L"layer"; this->layer->UseVisualStyleBackColor = true; this->layer->Click += gcnew System::EventHandler(this, &Form1::layer_Click); // // Form1 // this->AcceptButton = this->install_button; this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(807, 661); this->ControlBox = false; this->Controls->Add(this->layer); this->Controls->Add(this->uninstall_button); this->Controls->Add(this->install_button); this->Cursor = System::Windows::Forms::Cursors::Arrow; this->IsMdiContainer = true; this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } #pragma endregion private: System::Void install_button_Click(System::Object^ sender, System::EventArgs^ e) { InstallHooks(); } private: System::Void uninstall_button_Click(System::Object^ sender, System::EventArgs^ e) { UnInstallHooks(); } private: System::Void layer_Click(System::Object^ sender, System::EventArgs^ e) { FrmChild ^frm = gcnew FrmChild(); //hier kommt der Fehler } }; }
Da kommt immer der Fehler:
Error 1 error C2065: 'FrmChild' : undeclared identifier 2005\projects\maus hook layer\hook_form\Form1.h 128 Error 2 error C2065: 'frm' : undeclared identifier layer\hook_form\Form1.h 128 Error 3 error C2061: syntax error : identifier 'FrmChild' 2005\projects\maus hook layer\hook_form\Form1.h 128
Pfadangaben habe ich gelöscht...
Was mache ich falsch?
-
1. Du solltest die "includes" nicht in den "namespace" reinmachen
2. Du solltest den "FrmChild" mit vollem Namen angeben => Hook_Form::FrmChild
-
super,, DANKE