Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

(1)

What is Project::Subclass::NativeWindowsEvent and how to use it?

 

I've got codes in old C++ syntax and I want to change it to the new one.

 

// ===================================================================

 

// NativeWindow Subclassing

// ===================================================================

ref class Subclass : public System::Windows::Forms::NativeWindow

{

public:

delegate void WindowsEventHandler(Object ^sender, Message ^uMsg);

event WindowsEventHandler ^NativeWindowsEvent;

 

Subclass(IntPtr pWindowHandle)

{

this->AssignHandle(pWindowHandle);

}

 

void SendWndProc( System::Windows::Forms::Message ^uMsg )

{

//super::WndProc(uMsg);

}

 

protected: void WndProc( System::Windows::Forms::Message ^uMsg )

{

//__super::WndProc(uMsg);

if ( Project::Subclass::NativeWindowsEvent != nullptr )

Project::Subclass::NativeWindowsEvent(this, uMsg);

}

};

 

 

When I compiled it, the error message was:

 

Error C3918: usage requires 'Project::Subclass::NativeWindowsEvent' to be a data member

see declaration of 'Project::Subclass::NativeWindowsEvent'

 

How to change it to the new C++ syntax?

 

(2)

 

What is "__super" in old C++ syntax converted to new C++ syntax?

 

Thank you very much.

  • Administrators
Posted

C++ (managed or otherwise) isn't really my strong point, however I think the NativeWindowsEvent is a delegate of type

void xxxxx(ref Message Msg), other than that I'm struggling with the c++ syntax. Have you tried declaring a member of type NativeWindowsEvent?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Yes, I think I have to do like you said, "declaring a member of type NativeWindowsEvent". I guess it will fix the error. But I don't understand how to declare a member of type..

Can you help me, please?

 

This one is not a declaration?

event WindowsEventHandler ^NativeWindowsEvent;

 

Thank you very much..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...