Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a local Windows Application and have the output be piped into the Browser

I have Windows Application (.EXE file is written in C and built with MS-Visual Studio), that outputs ASCII text to stdout. I’m looking to enhance the ASCII text to include limited HTML with a few links. I’d like to invoke this application (.EXE File) and take the output of that application and pipe it into a Browser. This is not a one time thing, each new web page would be another run of the Local Application!

The HTML/java-script application below has worked for me to execute the application, but the output has gone into a DOS Box windows and not to pipe it into the Browser. I’d like to update this HTML Application to enable the Browser to capture that text (that is enhanced with HTML) and display it with the 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>
like image 603
Trey Sherrill Avatar asked Apr 26 '10 19:04

Trey Sherrill


2 Answers

  1. Have the executable listen on a port following the HTTP protocol.
  2. Then have the web page make AJAX-style HTTP requests to the local port with JAvascript.
  3. The executable returns text.
  4. The web page updates itself through DOM manipulation in Javascript.

Yes, this works. It is happening 5 feet away from me right now in another cubicle.

like image 155
Erik Hermansen Avatar answered Sep 28 '22 06:09

Erik Hermansen


This is called CGI

like image 35
renick Avatar answered Sep 28 '22 07:09

renick