My managed c++ code fails to compile with the error message
.Window.cpp(11) : error C2440: initializing : cannot convert from System::Windows::Forms::Form ^ to Enviroment::Window ^
No user-defined-conversion operator available, or
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.Window.cpp(11) : error C3754: delegate constructor: member function Enviroment::Window::_keydown cannot be called on an instance of type System::Windows::Forms::Form ^
Error 1 error C2440: initializing : cannot convert from System::Windows::Forms::Form ^ to Enviroment::Window ^ c:UsersThomasDocumentsVisual Studio 2008ProjectsProject_XProject_XWindow.cpp 11
Error 2 error C3754: delegate constructor: member function Enviroment::Window::_keydown cannot be called on an instance of type System::Windows::Forms::Form ^ c:UsersThomasDocumentsVisual Studio 2008ProjectsProject_XProject_XWindow.cpp 11
In window.h
ref class Window
{
public:
Window();
void _keydown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e);
}
In window.cpp
Window::Window()
{
Form^ form = gcnew Form();
form->KeyDown+= gcnew KeyEventHandler(form, &Window::_keydown);
}
and later
void Window::_keydown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e)
{
//stuff
}
Help!