Trouble raising events from C++ to be handled in C# -


I am trying to write a C # based WPF application that uses C + + DLL. The C # application is for user interface and has all the advantages of WPF. C + + DLL uses Win32 functions (for example to enumerate Windows).

Now I can handle C + application in C + + DLL to increase the event. This is what I have tried (on the basis of):

  // cpp file #using & lt; System.dll & gt; Using the namespace system; Structure WIN {HWND handles; Name of class four; Four titles; }; Zero W. Del (Win) Representative; Event wDel ^ wE; Zero gottwando (win window) {wE (window); }  

When I try to compile this code, these errors are thrown:

C3708: 'wDel': 'Incident' Inappropriate use of;

C2059: syntax error: 'Event'

C3861: 'wE': Identifier not found

Your event must be a member of some managed category, possibly static example:

  #include "stdafx.h" # Nom place system Include "windows.h"; Structure WIN {HWND handles; Name of class four; Four titles; }; Zero W. Del (Win) Representative; The referee class window is similar to a static class in C ++ / CliC # in the Seven Seal / Saral Seal Reef Class in the Events Event {Public: static event wDel ^ wE; Fixed Zero Gotwando (Win Window) {wE (window); }};  

Update

If you need this, then you can think of something like the following:

  #include "stdafx.h" # Include "windows.h" using the namespace system; #pragma Managed (push, off) structure WIN {// unmanaged C ++ structure handles HWD encapsulating unmanaged data; Name of class four; Four titles; }; #pragma Managed (pop) public value structure ManagedWIN // Managed C ++ / CLI translation of the above {public: INTERPTR handle; // wrapper for an HWND four classname; Four titles; Managed WIN (Constant Win Win): Handle (Win Handle), Classname (Victory Classname), Title (Win Title) {}}; Public representative zero wDel (ManagedWIN); Public Reef Class WindowAvents Subscriber Seal / Cement Seal Reef Class is like a Static Class in C ++ / Cly C # {Public: Static Event wDel ^ wE; Internal: static zero gatwondo (win window) {wE (managed) (window)); }}; Only secure in  

here ManagedWIN . There are net types.


Comments