Event Handling for MFC Dialog

Posted by Maksud on Stack Overflow See other posts from Stack Overflow or by Maksud
Published on 2009-12-23T11:24:50Z Indexed on 2010/03/29 10:03 UTC
Read the original article Hit count: 467

Filed under:
|
|

This is my second question of the day, pardon me.

I am writing a wrapper library to communicate with a scanner device. The source code was in C++ MFC. I am converting it to a plain Dll which will be invoked from C#. So, I am using DllImport in C# to call the wrapper library.

Now I am provided with MFC code and the library is a ActiveX Object, at least I think so.

class CDpocx : public CWnd
{
}

So in my wrapper library I will have an instance of CDpocx and will call it via C# P/Invoke. But the problem is CDpocx also throws some events which I need to catch. In traditional app, I would just attach an function with it. But How would I attach the events on non MFC class.

I have seen something like:

BEGIN_EVENTSINK_MAP(CVC60Dlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CVC60Dlg)
    ON_EVENT(CVC60Dlg, IDC_DPOCXCTRL1, 1 , OnReadyDpocxctrl1, VTS_NONE)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

OnReadyDpocxctrl1 is the function that handles 1 (Ready) event.

How can I gain simmilar function in non MFC class.

Regards, Maksud

© Stack Overflow or respective owner

Related posts about mfc

Related posts about visual-c++