How can I run a local Windows application and display it in a browser?

I have a Windows application (a .EXE file written in C and built with MS-Visual Studio) that outputs ASCII text to stdout. I want to improve ASCII text to include limited HTML with multiple links. Id like to call this application (.EXE file) and display the result of this application and stream it to the browser. This is not one time, every new web page will be a different launch of a local application!

The attached HTML / java-script application works for me to execute the application, but the output went to the DOS window window and did not translate it to the browser. Id like to update this HTML application so that the Browser can capture this text (which has been expanded using HTML) and display it in a browser.

<body> <script> function go() { w = new ActiveXObject("WScript.Shell"); w.run('C:/DL/Browser/mk_html.exe'); return true; } </script> <form> Run My Application (Window with explorer only) <input type="button" value="Go" onClick="return go()"> </FORM> </body> 
+6
javascript windows internet-explorer console-application
source share
4 answers
  • Ask the executable to listen on the port that conforms to the HTTP protocol.
  • Then the webpage will create AJAX style HTTP requests in the local port using JAvascript.
  • The executable file returns text.
  • The web page is refreshed through DOM manipulation in Javascript.

Yes it works. This is happening 5 feet from me right now in another cabin.

+2
source share

You already use WScript to run, it can also read StdOut .

 <html> <head> <script type="text/javascript"> function foo() { var WshShell = new ActiveXObject("WScript.Shell"); var oExec = WshShell.Exec("ipconfig.exe"); var input = ""; while (!oExec.StdOut.AtEndOfStream) { input += oExec.StdOut.ReadLine() + "<br />"; } if (input) document.getElementById("plop").innerHTML = input; } </script> </head> <body onload="foo();"> <code id="plop"></code> </body> </html> 
+2
source share

This is called CGI.

+2
source share

It would be easier if your EXE created a temporary file containing HTML, and then just ask Windows to open the HTML temp file in a browser.

0
source share

All Articles