Solved

Visual C++ Application Called From Web Browser

Posted on 1997-06-10
5
185 Views
Last Modified: 2013-12-25
I have a VC++ 5.0 application that retrieves and displays information from an Oracle database through ODBC.  I need a fast and easy way to be able to call the executable on the client from a web page.  The executable requires 5 parameters which I would like to pass in from input from the web page.  

Database - Oracle 7.3
OS - NT 4.0 Workstation/Server
browser - Netscape/Microsoft IE
web server - not yet determined, perhaps Microsoft IIS,  

Can I do this through a CGI script or a plug-in or how?
0
Comment
Question by:fitzg
5 Comments
 
LVL 5

Expert Comment

by:icd
ID: 1828194
The simplest way would be to write a script that interfaces to your program. To do this however there are a number of requirements.

(1) Your program must accept input as command line arguments.
(2) Your program must output to stdout device.

If your program accepts input from stdin rather than command line arguments then the problem is a bit more difficult, you need to open a pipe to the program to feed the parameters in. Possible on UNIX but a bit more difficult on NT (at least for me!).

If the program meets these requirements then you can write a bit of code something like:-

@output = `yourprog $in{par1} $in{par2}`;

This will feed the command line arguments par1 and par2 (taken from an input form that calls your script) and puts the results of your program into the @output array. You can then process the output or just print it as part of an html document.
0
 

Expert Comment

by:aviad
ID: 1828195
Why was icd's answer rejected? I think it is quite adequate.
0
 
LVL 5

Expert Comment

by:icd
ID: 1828196
If fitzg would care to comment then perhaps he/she would be more likely to receive an answer that *was* acceptable.
0
 
LVL 7

Accepted Solution

by:
faster earned 100 total points
ID: 1828197
Icd's answer is workable.  I guess maybe you don't like to write another script (which requires that you learn some Perl, although it is quite simple).

Another solution is that you add the CGI support directly to your VC++ program, this requires you do the following:

1. Retrive the parameters.
1) Get the value of environment variable "CONTENT_LENGTH"
2) Read from stdin, the size of which determined by "CONTENT_LENGTH"
3) You will get something like "param1=value1&param2=value2...", parse this buffer and do the url unescaping to get your parameters.

2. Do whatever processing you need.

3. Write the output to the stdout, starting with "Content-type: text/html\r\n\r\n", followed by a html-formatted result.







0
 

Author Comment

by:fitzg
ID: 1828198
With our time constraints, we didn't want to write another script.  I think a combination of both answers from icd and faster is the answer for us.  (Is it possible to split the points for them?)  Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question