Override mouse events MapWinGis.ocx and Windows C++ application

Hello

Is it possible to override in c++ application mouse events?
or even get selected layer, shape id, etc.?

example:

I see
MapEvents.MouseDownEvent += …
How does it in the c++ app?
Do I have to catch MousEvents by myself in the c++ app?

Best Regards

Hello @Mariusz, and welcome.

Note that you will have to set the SendMouseDown, SendMouseMove, and SendMouseUp properties = True for the OCX to generate mouse events.

Beyond that, what framework are you using in c++? Are you using MFC? Whatever framework you are using to load the OCX should expose the Map events for you to hook them.

Hope that helps.
Regards,
Jerry.

Hello @jerryfaust

Thank you for your answer

Yes, I’m using MFC.

And I see now the CDMap class has not any Send… function.
So it can be created without these functions?

In VS 2017 I have a “Cannot find coclass for interface _DMapEvents” error
But in VS 2019 it is created and looks like DMap class
BOOL CDMapEvents::Create(…), CDMapEvents::MouseMove(…) etc.

The map is created by:
mapWinGis.Create(NULL, WS_VISIBLE, mapRect, this, IDC_MAP);
When I try to create CDMapEvents same way its fails.

Best Regards