Solved

Visual C++ Application Called From Web Browser

Posted on 1997-06-10
5
181 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
Comment Utility
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
Comment Utility
Why was icd's answer rejected? I think it is quite adequate.
0
 
LVL 5

Expert Comment

by:icd
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now