Creating a Form inside a non-winforms application - c++

I have been working on a opengl engine and I know want to be able to use winforms to manipulate some objects inside it.
What can I do/change to let my application use winforms.
I created a win32 Console application originally.
(Or should I just create a winforms application and do the inverse of my question?)

Since you are opened for solutions, the simplest way would be to create an MFC application and host a WinForms user control in it. See Using a Windows Form User Control in MFC.
An alternative for hosting WinForms in a Win32 application is to use COM interop. Basically you'd expose some of your managed code to COM interop and that would create the form or user control in managed code. See Hosting WinForm and WPF user controls in Win32 form via COM Interop.

Related

How can I call an UWP API from a C++ desktop application

I would like to access Bluetooth LE devices using the corresponding UWP APIs. However, my application is a "classic" C++ application (3D game) that can't run as a UWP app. Is there a way to do that? Accorind to enter link description here these APIs are published, but I don't know the steps to access them I have only found some posts for Windows 8/8.1 apps that include the Windows.winmd and Platform.winmd metadata files and set the /ZW compilation flag, but this doesn't seem to apply to Windows 10.
You should be able to do this, as the Bluetooth classes (e.g., BluetoothLEAdvertisement) are marked up with DualApiPartitionAttribute (callable from desktop and UWP apps).
Using one of the older Win8.1 desktop samples should give you a good starting point for calling the APIs without requiring /ZW or referencing the winmd files. A good example is the desktop toast API sample.
If you go that route, you can use classic COM to create the UWP/WinRT classes via WRL helpers.
You can use the web that you make a web server and the C++ application use the same server and if UWP send the info to server then it will send the info to C++ application.
To safe,the UWP can't use the desktop app.

Develop web service with using MFC (without .net framework)

Can I develop a web service in VC++ with MFC and without using of .net framework?
I wrote several classes in VC++ and used CRecordSet, CString, CArray and some of the other MFC classes. I want to use my classes in a new project (web service). Then I cann't change all classes to use standard library.
I think , I should write web service in VC++ , without .Net framework (Unmanaged code). Is it correct? Is a simple Sample of web service in VC++ by Unmanaged code?
No there is no simple way to create a web service with unmanaged code only. The easiest way would be to just write a web service using C#.
Than just use a C++/CLI wrapper to access your MFC code.
This isn't a real problem.
Your MFC code should be capable run inside a standard DLL. There should be no UI core at all in it. And remember that a Web Service has no state!

Make CHtmlView enables activex control download

I'm a newbie to CHtmlView of Visual C++ programming. I need to make a web-browser application display website by IHTMLDocument2 interface which will need to download activex control from website and run it automatically. Here is the problem, the application which I have made is running well except the activex control on the website is not running. I have checked the interface of IHTMLDocument2 and also have override OnAmbientProperty to setup the flag to zero when dispid value is equals to DISPID_AMBIENT_DLCONTROL, but it still not load activex control on the website which are browsing by using My own web-browser app.
Can anyone tell me which document should I looking for? I'm so confusing about how to setup the security level on my own web-browser application to enable activex.
Thank you very much!
Making it work with MFC might be a bit tedious task. You would need to create a custom implementation of COleControlSite and COccManager for your CHtmlView. On the COleControlSite object, you'd need to implement IServiceProvider and IInternetSecurityManager. With IInternetSecurityManager::ProcessUrlAction you'd control how ActiveX controls are handled.
Here you can find some implementations of the above:
http://www.codeproject.com/Articles/4805/Advanced-customization-of-WebBrowser-Control-in-Di
http://www.codeproject.com/Articles/924/DHTML-User-Interface-Library
http://shareaza-code.googlecode.com/svn/trunk/CtrlWeb.cpp

Host a c++ desktop application on a webpage

I am having a desktop application which having a UI interface made in Qt linked with a library which is doing all the calculation stuff. Values from UI is taken and pass to the API's in the DLL to get the output which is shown on Screen.
Now i want to do the same thing by transferring my application UI to a web page so that people can access the tool from anywhere without any installation process.
I want to retain my c++ DLL code so i don't have to do a lot of work. I am thinking of just converting this DLL to a C++ server by any communication Process(Sockets). I want to host this application on my company's website. (We have to make the website also so we are open to any set of tools).
I want to know what will be the best set of tools to do this stuff. Also there will be lot of data exchange between the webpage and server so the wholething should be optimized also. I goggled a bit and find stuff like silverlight and ASP.NET, But i am still not very clear which option will be more suitable.
I am a c++ programmer with no web application development experience. I am open to learn any new technology.
Thanks
Why not use Qt on the web directly? There are several projects like this one: http://qtwui.sourceforge.net/
There is a netscape plugin that will host a QT application and an ActiveX control wrapper on the QT website. You could use one of those to wrap your application. Note that this approach would require the user (or their administrator) to download and install the plugin.
An alternative approach might be to run your application through a remote desktop such as XVNC, NX or an RDP based layer. IIRC browser based remote desktop clients are available for most such protocols.
A few options:
pick a messaging/queue implementation (like http://www.zeromq.org/) and provide a service
implement a Windows Web Service if you want to be more enterprise friendly: http://msdn.microsoft.com/en-us/magazine/ee335693.aspx
I would not expose the implementation on the internet. Enough to have a simple buffer overflow and the machine can be taken over quickly. Adding a layer between the app and the web provides an easy way to validate input, access, stats ...
You should be able to use your DLL from an wt or cppcms application. Then you do not have to learn something new and can just use C++.
The way I'm currently doing this is with Boost.Python + django

MFC and Scripting?

I have an MFC application.
What scripting library can I use to give users to access my application via scripting?
Can I do something like:
Use JavaScript + MFC and build a front-end using JavaScript and mini-HTML viewer in a single EXE?
Maybe this question should be:
I like server-side JavaScript and MFC/C++. Can I compile an embedded Javascript and execute it inside my MFC/Javascript shell front-end to present a Win32 app and script whole application logic via JavaScript?
It needs to be closed-source, so I cannot use GPL
The CodeProject article Adding Macro Scripting language support to existing MFC Application sounds promising...