Click here to Skip to main content
15,881,794 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a requirement, that I need to develop an application in HTML with out connected to any of network. In this HTML page I need to display some system specific information like BIOS info or Battery Info.. etc. For these we have logic written in C and C++.

Here I need to communicate with these dlls and display in HTML page. Is there any way to call C++ dlls using Javascript. If yes, please provide working sample code.
Posted

Don't fart about trying to escape the browser's sandbox to call native code. Implement an app that works like a web-server - you can use the C++ code directly then.

While it can be pain to use I'd suggest WT as a good place to look. It uses a QT style object model and generates fairly portable web pages.
 
Share this answer
 
Comments
yoganandaraol 6-Nov-13 4:46am    
Thanks for your reply..
Actually I am looking for an application which need to run on all operating systems. So we are opting for Open Standard technology(HTML, XML, Javascript), for the sake of compact package, but it's creating mesh.. Yes, Considering my requirement, I can go for Qt(which has support for all operating systems including Android).
You cannot do it. This is set this way by apparent security reason: JavaScript hosted by a Web browser should not be given an access to the client system, and using such capability would open the doors for intrusion of malicious Web applications into clients' systems.

There is one dirty workaround: through the use of an ActiveX component. But I would strongly discourage doing any steps in this directions. First of all, it would break the safety mechanism I described above. Many computer-savvy users would blacklist your site if they learn that you are trying to use DirectX in the browser. Besides, this feature won't work on all browsers and systems. It is mainly the IE and Microsoft OS "feature".

Still, this ActiveX-based approach is used. I usually face it only in two situations: 1) used as a part of corporate technology inside a corporate network; to me, this is already a symptom of a bad company and ill approaches to safety, despite of the illusion of "intranet-only" safety; 2) use by brand-name computer manufacturers for remote computer diagnostics and service; but this is only possible due to the trust computer buyers have to those brand-name companies, once they already purchased a computer with pre-installed OS and other software.

As you can see, your conclusion should be: ActiveX is not an option. What to do? Perhaps you can get and advice if you explain your ultimate goals; why do you think that the system information you want should be Web- or browser-based…

—SA
 
Share this answer
 
A couple of ideas ...

1. You can do this in mozilla eg. Firefox.

Write a "chrome" extension (not to be confused with that other "chrome"). Trusted extensions can call native code by way of XPCOM.

https://developer.mozilla.org/en-US/docs/The_Joy_of_XUL[^]

2. Another option is to write a native program that is basically an embedded web server (bind to localhost) that offers the information in XML form. Leverages all the usual AJAX techniques. Deploy two parts - an "app" as HTML/CSS/JS and a service EXE. The embedded web server could even serve up the app content to further simplify deployment.

A C++ Embedded Web Server[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900