Can i use CView-derived classes in an activex control? - mfc

I have developed a MFC desktop application that views building models read from an IFC(Industrial Foundation Classes) file using DirectX to render the models in a CFormView.
Now, I want to port my application to work as a Web application using ActiveX can i achieve such thing using the same structure i used in the desktop version or do i have to consider other things ?If there other things what are they ?
In other words what kind of classes i could use in desktop application and can't use it in an ActiveX control ?

This might help you: Convert simple MFC CView/CDocument/CSingleDocTemplate app to ActiveX control

Related

How to make a Native UI window in C++ with HTML/CSS UI in the client area

I have this program, it is apparently coded in C++, and I can see that the window(dialog box) is a native one, but in the middle of the window, it has modern looking UI elements, and when I right click on the client area(with modern UI elements) it shows a context menu like a web browser does(with almost same items as Internet Explorer).
There is also a newer version of this program, apparently it has coded same as before but the content in the web browser like area is now coded in Silverlight.
So according to my understanding this is a just a native window with an HTML web page in the client area, which allows to take advantage of CSS designing.
I would love to know how such a program be developed C++ and how does event handling is done in such a system.
Any help is much appreciated.
Thanks
Basically you do this by embedding a web browser control into your application. Microsoft directly provides such a control or you can use 3rd party alternatives.
In WinForms you can add a WebBrowser control like any other common
control, see here. You can also include the same control in a
WPF application.
The above .Net WebBrowser control emulates IE7 by default (I believe) even if
the user has a newer version of IE installed. You can make it
use a newer version as shown in various online resources. A better option is however, to not use IE or the
WinForms WebBrowser control at all. Consider CefSharp. "Cef"
stands for Chromium embedded framework, which is a native library. CefSharp is a C# wrapper
around CEF.
If you are not using C#, in a native Win32 application you can just
embed CEF. Or you can embed Microsoft's IE-based control
as, essentially, a COM object, but I would recommend the
former in this case. This is exactly what CEF is for.

Does using a WPF control inside MFC oblige to use -NET virtual machine?

I want to embed a Bing Maps layer with WPF inside an MFC control. Does this mean that my MFC app will no longer be native, but managed code (and therefore running on the .NET virtual machine?)

ActiveX control in C++ form based application

Is it possible to use ActiveX control in C++ form based application like we use in MFC dialog based applications?
Yes, you can host an ActiveX control in WinForms using the AxHost class.

how to add windows form in mfc application?

i wanna know how to add windows form to the MFC application (Dialog-based) and connect it with the MFC Dialogs,so i can program with visual c++ ?
http://www.functionx.com/visualc/Lesson04.htm
I think this is what you are looking for, hope this helps.
The MFC class CWinFormsControl "provides the basic functionality for hosting of a Windows Forms control in a MFC application".
One can encapsulate more Winform standard controls in a .NET custom control (derived from the System.Windows.Forms.Control class) and then use it in the MFC app through the CWinFormsControl.
The MFC application must use the /clr flag (Common Language Runtime Support).

Can I create a ActiveX Control from a WPF UserControl and use in a non CLI C++ application?

I have created a Windows Forms UserControl that can be exposed as an ActiveX Control. Now I am trying to do the same with a WPF UserControl. The Winforms UserControl base class I noticed is ComVisible however the WPF UserControl class is not. Am I trying to do the impossible?
Is the only way to achieve this to write a WPF control and then embed it in a Winforms UserControl using ElementHost and then expose that Winforms UserControl as an ActiveX control?
Yes, I think ElementHost is the approach you will need to use if there is a chance of this working.
This is because WPF controls are inherently windowless with everything being rendered in retained mode via a DirectX surface which WPF maanges.
There are interfaces for "windowless" ActiveX controls but the COM interop provided by .NET does not map these onto WPF objects either.