Wrap ActiveX to Intercept Calls (ActiveX Proxy wrapper) - mfc

I have a deeply ingrained ActiveX control in our system which I would like to learn about / fix!
I am thinking about wrapping this MFC dll with a transparent proxy class that will intercept the member etc.
HOW can this be approached in MFC.
Thanks!

You could start by generating an ActiveX wrapper using AxImp, then modifying the generated wrapper with your intercept code. See this question for details on manually generating the wrapper.

Related

How to create an ATL class that implements CDialogImpl and IPreviewFrameHandler

I'm trying to create a dialog that hosts a file preview handler. I started by creating an ATL dialog (through the Visual Studio menu), which derives from CDialogImpl, so that part was pretty straightforward.
But I've now learned that hosting a preview handler involves implementing IPreviewHandlerFrame. So I guess I have to derive from that, implement its methods, and implement IUnknown as well. And then I guess that the dialog needs to be created via CoCreateInstance? (Not sure about that part.)
So I'm not sure if I should go back and start over, instead creating an ATL Object that derives from CDialogImpl and IPreviewHandlerFrame. That would involve all of the ATL registration and everything, and I'm not sure if that's necessary . Or is it better just to add the IUnknown methods? But even so, how would the class be instantiated? I'm not sure I want to interfere in the ref-counting or anything like that.
Thanks for any guidance on how to do this.
Or maybe another approach would be to implement IPreviewHandlerFrame in its own ATL class, and then instantiate it in the CDialogImpl?

Questions about C++ GUI project types and controls

I like C++, and I have used GUI many times in C#, but this time I would like to make a GUI in C++. I already know the basics of the Win32 API, such as creating a window, resource scripts, commands and processing of commands, and the basics of some controls.
 
But what I would like to know, is how to choose between pure Win32 API or MFC to make applications with sidebars that can be disconnected and connected from the window just by clicking and pulling, as the image below:
And the other type of control I'd like to know, is what kind of list is this in red in the image below? In the bottom circled, I know it's a mix of tree view with that kind of list. I thought it was a table control or similar, but it is not.
Anyway, I must continue studying pure Win32 API, or should I jump directly to MFC? I do not intend to use .NET or C#, only pure C++ with some libs.
You can also take a look at more modern C++ gui frameworks, like Qt.
If you want to learn more about Windows, you can use either Winapi or MFC. //MFC is just a pretty thin (and oop) layer over Winapi.
QBittorrent is using Qt framework, so those are most likely a QListWidget/QListView and QTreeWidget/QTreeView.

VC++: How to capture the Events fired from an ActiveX (.ocx) inside ATL project

I am making an wrapper of a control, an interface of the ocx object. Had to create an ATL project and then add/load the ocx file. It has exposed properties, methods and events. I am able to control/used its properties and methods however I was stuck on events, especially handling it after it fires.
Have searched it on google and most of the guides I've found are making it from scratch or from the ATL events itself. What I am trying to achieve is to make use of the exposed events from the ocx. Any have idea?
Thank you very much.
In ATL your standard options to handle COM events is to use IConnectionPointContainer and friends as explained in Event Handling and ATL:
For information on how to fire events and implement connection points, read ATL Connection Points.
Or, and especially for ActiveX control events, your second option is IDispEventImpl class references there by the first link as well:
Using IDispEventImpl, inlcuding sample referenced
AtlEvnt.exe sample shows how to creates ATL sinks by using the ATL IDispEventImpl and IDispEventSimpleImpl classes
IDispEventImpl is explained in detail on other resources too, e.g.:
Understanding COM Event Handling on CodeProject

Writing a wrapper class for an ActiveX control

I am given a video calling software which implements an activex control to render the video in a web browser. As activex works only in IE i am given the task of implementing a cross-browser version of the activex control using FireBreath framework.
I need to write a wrapper class for the activeX control.
I am new to activex,visual studio(eveything involved in the project). And the activex code has thousands of lines of code. It is taking a long time for me to understand the code.
Does anyone have any good example wrapper classes and any other suggestions or links which would help my project?
The closest I know of is this: https://github.com/firebreath/FBAXExample
It's an example of hosting an activex control inside a FireBreath plugin. You'd be better off (and a lot cleaner) if you can do a complete port, but it may be possible to do it with just a wrapper; you may also want to look at the WebView library in FireBreath itself, which embeds IE inside a FireBreath plugin. You can find it here: https://github.com/firebreath/FireBreath/tree/master/src/libs/WebView/Win

Need a good unmanaged C++ OCX example

I need a very simple and clear example of how to create an OCX in unmanaged C++ code. Ideally, I'd like to consume it in Office, but any container (i.e. VB6, .NET WinForms) should be good.
I am having trouble seeing how I can add controls to the OCX canvas... I have seen examples of opening dialogs from within the OCX's load event... but that is not what I want... I need the GUI in the OCX itself.
Have you looked at this Microsoft tutorial. It uses MFC. If you want to create a windowless control you would need to use ATL.