How to convert an ActiveX (webbrower hosted) project into static library project? - c++

I have an ActiveX component which contains a control (webbrowser control embedded in composite control dialog pane) for accessing certain URL. The ActiveX component accessing URL can be used in other MFC or VB projects. The usage is to register the ActiveX component (use regsvr32 cmd) and then insert the control in a dialog window by using "Insert ActiveX control".
Now I am planning to convert the ActiveX component to static library with the same browser window and web access functions. I wonder how to do it? In addition, how the browser window (in static library) can be used in other MFC projects. Is it through functions call? Is there a sample project available?
I used Microsoft .Net 2003 as development tool.
Thank you very much in advance.

I'm a little unclear about the extent to which you think you can put all of that in a static library.
This is probably not going to be as straightfoward as you think. The wizard and code in VS/MFC/ATL which allows you to insert an ActiveX control in a dialog is doing a lot of work for you. That said, it makes certain assumptions about the nature of the site for the ActiveX control, such as how the message pump works, who is the owner window, the threading model, and so on. In a dialog, these are knowns. In another context, they are not.
The right way to go about doing what you're doing is to leave it as an ActiveX control. Maybe if you stated what problem you are trying to solve by putting it into a static library, we could give other options.
The WebBrowser ActiveX control is really a wrapper for the shdocvw.dll library, in the system32 folder. shdocvw.dll is the heart and soul of IE (and, by extension, much of the Windows Explorer interface). It's all very heavily based on COM, which has its own rules for loading libraries and so on. So the site (any application which wants to use your ActiveX control) really needs to be friendly to ActiveX/COM anyway.

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.

Can windows 7 and 8 common dialogs be hooked

I am trying to replace all Windows Common (Open/Save) filedialog calls with my own custom dialog. From what I read so far, I could do this with a hook on the calls either by writing my own or by using libraries like detours or easyhook. But someone told me recently that such an approach is only possible pre-Vista, because of the change in sessions architecture and it is impossible to do such a switch in Win 7/8. Now, I am not a guy who likes the word 'impossible' :) So if you have any advice on the matter, any at all, please do tell and I will appreciate your kindness.
For what I what to do, my application will be run by the user, it will reside in the tray, and when the user calls for Open/Save dialog from any application, it should replace the default common dialog with a custom dialog.
The newer style Common Item dialogs are implemented as standard COM objects, so you could just implement your own DLL that exposes the same COM interfaces (IFileOpenDialog, IFileSaveDialog, etc) and then override the default registrations in the Registry with your own. That way, every app that uses the dialogs will load your DLL instead of Microsoft's.

Can I get the HWND of an embedded Flash ActiveX control from browser control in my application?

It seems that in browsers, the Flash Control uses an optimized way of drawing. I could not achieve this while embedding the control directly (fast animations are choppy in the control I directly embed, not in a browser). I have found an open source project that implements an optimized drawing, however it is pretty complicated (also, very dependent on the whole project, so not easily reusable in mine).
I would like to try and use an IE ActiveX control, load an HTML that embeds a Flash Control, then get the HWND of this control do some application specific things (already implemented in my project). Is this possible? How?

Implementing ActiveX Control for web browser

My requirement is to develop a ActiveX control which can send the byte stream to serial port. The ActiveX control should expose only one function like
SendData(char* data, int nLen, int nPort)
This function should be able to be invoked by pressing a button developed in java rendered in Internet Explorer(both 32 and 64 bit). I am confused whether i should go with windowless ActiveX control using MFC/ATL or Browser Helper Objects. In future i may need to support Firefox also.
Any help will be appreciated.
Although BHO would work, ActiveX will suite better your requirements. BHO are very similar to ActiveX - they are both native or managed code running in the browser window. The difference is that BHO is available for all pages (it is instantiated when the browser tab is created) while ActiveX which is not a BHO is instantiated when some Javascript code in the page creating it (or with the <object> tag. The life time of a ActiveX is the page.
ATL is a better choice. Use the VS Wizard, and create an ATL based COM in-proc server. Then add a COM object. Since you want to call it from HTML make sure it is a dual interface (i.e. derived from IDispatch). Add the method that you want to the IDL file. In COM, the calling convention for string arguments is BSTR, and the standard convention for array is SAFEARRAY. How do you plan calling the method from your Javascript code?
Depends how you want to instantiate your object from the HTML page. You can have an <object classid='clsid:'class guid'> or you can use Javascript: var myobj = new ActiveXObject(ProgId). Both methods are valid.

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