Run userscript within the IE web browser control in a MFC application - c++

I am developing a C++ application using the Internet Explorer webcontrol. I would like to use some userscripts to modify the webpage.
Do you have ideas how I can achieve this?

You're looking for IHTMLWindow2::execScript().

Related

Using GDI+ vs HTML page

I am working on an application which is UI intensive (i.e. we need to customize all the control to look different).
For this is I planned to use GDI+ in win32. But one of the suggestion form our team member is,
Instead of using GDI+ he asked me to have a web browser control, in that he asked me to display local html.That html page contains customized controls.
Form his suggestion I created a web control and used some UI intensive local html pages. That looks good.
But my question is, is it is a good idea to use web control to solve this?
Using a web browser control to solve this problem is common. There are many applications out there that already do this. For example Steam uses Chromium instead of the web browser control to do all its window skinning. Windows 8 metro is another example of an HTML-based interface. There are even entire frameworks built on html-based interfaces such as Appcelerator. There are many benefits to going the web browser control route but it is not easy to get it right.

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

developing browser extension for content filtering

I'm developing an application for content filtering. i'll use it as web service but my problem is that i hadn't developed any extension for firefox or ie before. i read some about firefox extensions and now i know a little about it.
firstly can i use web service in a firefox/ie extension? if yes, can you give me a link of tutorial or sth like that?
all suggestions are welcome.
The question is too broad. Yes, you can call a web service using XMLHttpRequest, for example.

Can I use XPCOM to create and manipulate a Firefox window as I would use win32 COM with IE?

With win32 COM I create an Internet Explorer instance and control it almost fully from my python code (manipulate windows, DOM elements, etc). More specifically, using DispatchEx('InternetExplorer.Application'). Can I do the same using XPCOM and C++/python?
I need to automate certain actions taken on the html ui of some websites, so no I can't use urllib and I can't use selenium, because it doesn't work with cross-domain urls. I've wrote a wrapper class for Internet Explore where I can create a browser window and do anything with it, but I would like to do the same with firefox as well. I've thought about creating a XUL application that exposes the DOM functionality through a tcp server written in XUL/js. I'm not even sure that's possible, but if I can do everything from my python code without running xulrunner externally, much better.
I don't know about programmatically creating and controlling full Firefox instances, but Mozilla can definitely be embedded using XPCOM.
The Mozilla embedding FAQ, embedding how-to and the embedding APIs overview should get you started. There are also other means for embedding.
I have used the nsIDOMXULElement to attach event listeners in my XPCOM C++ code. I haven't tried modifying the UI, but it will probably work as well.
For an example on how to get an nsIDOMXULElement look at the call "SetVideoWindow" in Songbird's code here.

Google Earth and Windows application

I have a C++ Windows application continually updating lat, long and altitude.
I would like my application to incorporate Google Earth to visually "track it".
Any advice or pointing in the right direction would be appreciated.
Thanks.
You can embed the Google Earth plugin into your application as an ActiveX control. The API for the control can be found here. You need to instantiate your GEPlugin control and from here you can retrieve all the other COM objects. There is no need to register with Google for the development key. This is not supported by Google as it bypasses the official method of development using Javascript.
Starting point - look at using a web browser as a control/component. For example, Internet Explorer can be used as an ActiveX control. Not easy in plain C++, but supported by MFC - which I'm not very familiar with.
I can't give any more specific pointers than that, unfortunately, except that I tried it once a few years ago (just for fun) and couldn't get it to work. I could get it into a dialog, but when I told it to load a page, it would stay blank.
Still, it is possible - look at all the magazine coverdisks that have "their own web browser".
Sep,
Can you provide a few more details on how to do this with the GE Plugin? I've gotten it working by embedding a browser object in my C# app, but not directly as an ActiveX control. If I can avoid having to create a web site to host javascript, then I'm all for that. Thanks!
Bob