Cristhian Alcantara Cadillo

Index

 Welcome

 University

 Resume

 Programs

 Linux

 Contact me

 Links

 Other Stuff

Things about Peru

Machupichu
 

Java Stuff

Unix Scripts

Visual Basic

 C++

Scheme

WebObjects

VisualBasicBanner

Visual Basic Common Gateway Inteface (CGIs)
 
In my personal opinion I suggest to use Servlets or Perl to create more powerful cgis, but if you have a windows web server that supports  executable cgis created using Visual Basic,Visual C++, etc this is a good and easy way to develop on-line databse application. Security is responsibility of the server, for example: encryption.

 First, I searched the web looking for a visual basic module that supports http requests like a simple cgi script or program. I found the following module (*.bas) written by Kevin O'Brien:  obrienk@pobox.com , obrienk@ix.netcom.com. The module is called: ”CGI4VB.bas”.

What you have to do first is to find out how your web server supports executable applications. sometimes there is a folder called win-cgi,or cgi-win but i used this program in the cgi-bin directory.

Second, you have to make a new Visual Basic Project, and in the properties table specify  that the program has to begin with the main subroutine. When you create a Visual Basic Project for the first time, there is a frame available  where you can put buttons, textfields, etc. You have to delete this frame, because Visual Basic use it  when you run the program and we want Visual Basic to run first the “main” subroutine.

Third, you have to add the “CGI4VB.bas” module to the project. If you read this module you can find the main subroutine. This is the first function Visual Basic is going to call when you run your cgi. The main function call the following subroutines:

         *  InitCgi                ' Load environment vars and perform other initialization
       * GetFormData      ' Read data sent by the server
       * Cgi_Main            ' Process and return data to server

The Cgi_Main function is for your program
 

Fourth, create a module for your program. This module must have the “Cgi_main” subroutine, and you put here your program stuff.

Finally, you can use visual basic functions like a common program, for example, accessing databases like Microsoft Access.

Here is the “CGI4VB.bas” module (In English). And here is a module example of a program that uses  the CGI4VB functions and can access a Microsoft Access 97 DataBase.  Regrettably it is in SPANISH, but the logic is the same. Now I don´t have the Databse (*.mdb) file. Here is another module that reads a file with html script and is called by my module example.

Here is one complete project

Here is another complete project

_____________________________________________________
Welcome Linux stuff My University Resume
Programs Contact me Links Other Stuff

Last Update:
Wednesday, December 26, 2001