Multiple Internet Explorer versions side-by-side in one application - c++

in the MFC application I am working on, I need to have an Internet Explorer (we are using the component CHtmlView) displayed, currently we are able to change the rendering mode the IE works in by using the FEATURE_BROWSER_EMULATION registry keys. However that only allows us to change the rendering mode of all the CHtmlView instances in the application, plus to apply that change, we must restart the application.
The problem is, we would like to have more than one version of the IE displayed side-by-side in our application. I know that it is possible to get multiple IE versions on one computer, but I'm not sure, how to get them all in one application.
We have some ideas, how to solve this problem, but they are not really a trivial solutions, so I want to ask for your ideas. Anyway, here is what we've come up with:
Download the source code of the page, add the document compatibility tag, change all the addresses in the document to the absolute ones, and save this page to the disk. Then reload the page from the disc with the IE. This solution works only partially, because although it makes IE to use the correct rendering mode, the page fails to load some of the resources, because it is in the different location than the original - the addresses we had changed works well, but for example the JavaScript generated ones doesn't. And this solution is generally very messy, so we had dropped that.
Use multiple processes - each IE version would have it's own executable/dll library, we use the browser emulation feature on each executable, and then somehow glue this into one application (I admit, I have no idea how, as I've never used multiple processes with windows/MFC). But I don't know, if that solution would even work...
Create a proxy for our application, that will change the downloaded source code in a similar way as the solution 1 presents - it will add the document compatibility tag, to force the IE into the desired mode, but it can leave the addresses intact, as the IE would see the source as coming from the original location. This solution seems to me like the safest one, but like with the 2. solution, I don't know how to make a proxy layer for our application, and more importantly, how much time would it take.
So do you have any ideas on how else could this be solved? If the solution uses something other than CHtmlView, so be it, we can always change that.
As for the IE versions, we would like to have, it would be nice to support IE6, but it is not necessary, the lowest required version is IE7.
Thanks ahead for your time, any ideas would be appreciated.

In the end I have solved this by using
our own proxy server (implemented using boost asio), and modifying the http request/response headers to force IE into the correct compatibility mode.
several executables with unique names, with the compatibility mode set in the registry. Each browser version ran in a separate process.
As it turned out, the proxy server solution didn't always work as expected. The multi-process solution did work as intended, but in the end, the emulated browsers didn't always work as the real browsers, and the whole solution wasn't 100% reliable.
I hope this will help someone in the future.

Related

Why does Oracle recommend using model.setValue() method over setRecordValue() when setting multiple values?

I am using Apex 18.2. According to Apex' JSDoc, Oracle recommends one should use model.setValue() method over setRecordValue() when setting multiple values. But unfortunately, it does not mention the reason behind that. Does anyone know what it is?
I admire your curiosity. It will make you a great developer. :)
To really know the difference, I recommend learning to read the source. While difficult in the beginning, it will get easier with time and become an invaluable skill.
The APEX team makes this quite easy. Open your developer tools and then run the page in debug mode. This will load the unminified JavaScript source files into the DOM rather than the minified versions. Go to the Sources tab and locate the relevant file (it will take time to identify the right file in the beginning, but it gets easier too). You can open the file directly (better for debugging) or go right-click it and open it in another tab (better for scanning).
Then just search the code for the function you're after and read it...
As you can see, calls to setRecordValue, make a call to getRecord before proxying to the model's setValue method anyway. This is just a code path that you can avoid if you're making multiple setRecordValue calls. It's probably a bit of a micro-optimization, but they can add up.

Getting d3.js to work with raphael.js

I have recently implemented some data visualisation using d3.js, I'm now trying to get this to work for Internet Explorer browser versions 7 and above. The common suggestion to get this to work, is to combine d3.js with raphael.js, which is a cross browser graphics library.
There already seem to be some implementations of such libraries such as
r2d3.js :
d34raphael.js :
I'm trying to understand if these existing implementation already have d3's capability of data binding and the physics implementation of the force layout to implement something as simple as this d3 example : http://bl.ocks.org/1095795
I have been looking into this too and a number of options came up.
Chrome Frame - A browser plug-in that actually uses chrome underneath, meaning SVG just works. This is great if you're able to deploy plugins to the browser, for a real commercial environment however this may not be possible.
SVG Web - The aim is it bring SVG to all browsers. It looks like a fairly large project, one that's had Google's input. This doesn't however work out of the box with D3 though I don't know much about the issues.
D34Raphael - You've mentioned this one, I found again it doesn't work out of the box. Check the project out on GitHub, there hasn't been any commit activity in months and there's some pull requests "first pass on trying to get support for .on() required for event binding". If it doesn't support events, is that an issue to you? I'd generally keep away from this one.
R2D3 - Again another one you mentioned. I took the Sankey example from the D3 website and had to make a few changes to get it working. The main things I couldn't get working (Drag Events, Groups - though can use an alternative). It took about a day of effort to get the example working in IE8 and I believe is in a useable state. The project on GitHub is also much more active, the developer is committing, pulling work in and is very active on discussions etc. This gets my vote.

Visual C++ Best way to monitor visited websites?

My program needs to monitor all websites that are visited when the program runs.
I've been found some ways to do it and I'm wondering which way thats "best" (with best I mean, easiest to implement and offering the best performance). The program is to newer versions of windows only! It should work on both x86 and x64.
The browsers that I need to be able to monitor is IE, FireFox, Chrome and Opera.
I could watch the history files of each browser, but this would be a pretty bad way to do it (newer versions of the browser could make the code stop working etc)
I could check every window (HWND) and see if its a browser that visits a website... But is this really a good way to do it? If so how to I do it? Links or code snippets thanks :)
I could use a packet sniffer, but that would be kinda overkill if I just want the urls...
A proxy wouldn't be a good solution (Am I right?) because it would slow the browsing down (I think so at least)...
Or could I do it some other way thats better?
Since you need to handle multiple browsers, a proxy solution is going to be the most robust way to go about it - and if designed properly, shouldn't incur too much overhead. Packet sniffing is imho too complex.
You might be able to hack something specific togeher that supports your current versions of currently desired browsers, but do note theword "hack", and add in "maintenance nightmare" to the mix.
Also, you might want to rethink your tags - the qeustion doesn't really have much to do with .net, vc++ or vstudio - it's likely going to require the win32 api, though :)

Standalone Desktop Application

I have been tasked with the creation of a desktop application within some very rigid constrains. The first version of the application was quite small, only intended for some specific tasks, but it seems like the application was quite liked, so I've been asked to improve it a lot.
The initial app I created was made as a hta with heavy doses of javascript and jquery, using a XML to store information (through MSXML2.3.0), but the increased amount of data makes me think it won't be able to keep up with the requirements, so I wanted to remake the application on a more solid base. Of course, I'd rather keep the interface more or less consistent with what I've already shown, and I'd prefer not having to rewrite all the code.
The restrictions are as follows:
-Desktop application. I cannot develop a web application, as not a single target computer has a solid internet connection.
-No need of installation (copying and pasting the folder should work, and should keep all the data consistent).
-Should be relatively multi plataform. The only information I have about the target machines is that all of them have a windows XP OS or newer, a MS Office 2003 suite or newer, and some kind of PDF reader.
-Should be able to embed and show different file types, such as diferent image formats, pdfs, and office documents. That said, for office documents, as long as I can link to the document and open it by instanciating a common MS Word/Excel/wathever app, it should be good enough, although interoperativity with the suite would be great.
I've been searching through the net, and I've found some interesting options, but I'm not sure about them.
On one side, I think XML won't be able to keep up, although I suppose I could make it work if I distribute the data through several xml files. I've been reading about open source embedded databases, such as SQLite, and it looks like this could work.
On the other side, I feel like the hta basis I'm using isn't going to work that well if the application keeps growing. I've checked lots of alternatives, but all of them give me some problems.
Cappuccino or Chromeless looks like good ideas, but both of them require a certain degree of HTML5, which is something I can't be sure the machine's browser will support enough. Also, NativeHost for Cappuccino seems to work only on Mac OSX. Xul looks interesting, but unusable.
Another option I've found is porting the app to Qt, but I don't know how hard would be porting the app to Qts, and it looks like I can only use the ActiveX needed for the embedding of MS Office applications with a proprietary license. Although that's comparatively less important, but I'm sure in the future I'll want to include those features.
That's how I stand. Do you think keeping the hta + XML architecture (or any variation thereof) could still work? Do any of the alternatives I've mentioned be viable? Do you know any other alternative?

Can an application pretend to be a file or folder?

I've been looking into centralising my computer game saves to make it easier to backup and restore as well as putting them up on the cloud via dropbox but there in so may places that it makes it quite difficult. I noticed the Windows 7 and Vista now support Symbolic links so I've been playing around with that but I was wonder the follow:
Is it possible (code example or a point in the right direction) for an application (vb.net or C++) to spoof a file or folder?
E.g. Application A (a game like Diablo III or Civilization V) attempts to read or right from file A (the game save), application B (the save repository) detects this read/write request and pipes the request through itself preforming the request on file B (the actual game save in another location). Application A is in no way altered and treats the file normally.
Note: I realise there are many simple ways of preforming the same task in essence such as monitoring the use of Application A or periodically checking file A and copying it if it has been altered since the last check etc but all these methods have draw backs and less interested in making it work than if it is possible.
It is entirely possible to do this through a file system filter driver. For information about these, take a look here:
http://msdn.microsoft.com/en-us/windows/hardware/gg462968
Filter drivers can hook into CreateFile operations and redirect the create to a different place if you want, but they are much harder to write as compared to normal applications. They run in kernel mode and must obey the limitations of drivers.
You can "fake" special folders, like control panel does, but I don't think you can create anything accessible/writeable (in an easy way). I might be wrong though. I had the same idea once too (as a compatibility step for some company stuff), but couldn't find anything supporting an easy way to do it. It seems like it might be easier to be done on Unix systems (but that's obviously no option here). Also, I wouldn't expect any nice or easy solutions for .net.
Only approach I could think about right now, would be highjacking the according API calls (e.g. FileOpen) to reroute/manipipulate them (similar to what root kits do), but I wouldn't say that's a good idea, considering it might be detected as possible malware or cheats by things like punkbuster or antivirus solutions.
Yes or no depending on (using your terms) the level of abstraction that Application A is using.
If Application A is performing a CreateFile wto start access and passing a fixed filesystem path then Application B would need to emulate a file system and do so in the kernel.
On the other hand if Application A were to user HTTP with RESTful URLs then the HTTP server could answer all requests from files or by dynamically creating the content.
So the question can only be answered in specific by knowing the details of Application A.