Link to home
Start Free TrialLog in
Avatar of jfl
jfl

asked on

How do I both use cgi32.bas and VB5CGI?

How do I both use cgi32.bas and VB5CGI?
Avatar of mrmick
mrmick

Yes, I know about this also, I've got several apps I've written running on my server... assuming you're referring to Bob Denny's WinCGI.  However, this is much more complicated than your count question.

Do you have (close) access to a WinNT Server with IIS?

Avatar of jfl

ASKER

Yes, I'm referring to Bob Denny's WinCGI.

I have access to a WinNT running WebSite Pro 1.1

I can run my scripts through cgi-win but I'd like them to run through cgi-bin.

VB5CGI:
http://ourworld.compuserve.com/homepages/stsch/VB5-CGI.htm
Create a sample app.  Include the CGI32.bas and a new module and name it "Sample.bas".  Set the project property "Startup Object" to "Sub Main".

Put in the New Module the following:

Public Sub CGI_Main()
  sendheader ("hello")
  Send ("<h1><strong>Test of CGI executable</strong></h1>")
  sendfooter
End Sub

Sub sendheader(Title As String)

    Send ("Content-type: text/html")
    Send ("")
    Send ("<HTML><HEAD><TITLE>" & Title & "</TITLE></HEAD>")
    Send ("<BODY>")

End Sub

Sub sendfooter()
    Send ("<HR>")
    Send ("</BODY></HTML>")
End Sub

Compile into an executable and put in the cgi-bin folder.  Execute it with a url and path to the exe created by compiling the sample project.

There may be other issues with WebSite Pro 1.1 - I use an ISAPI Filter to redirect to my WINCGI apps because I'm running WinNT with Internet Information Server.  I have no experience with WebSite Pro.


Avatar of jfl

ASKER

I know how to use cgi-win code, but I do not wan't to use cgi-win

If I use Send it will use cgi-win!

It must be possible to use cgi32.bas and VB5CGI.

Do you know about VB5CGI?
Are we talking about the same thing?  WinCGI is the only kind of CGI VB is capable of because in standard CGI, the stream data is passed via stdin and stdout.  stdin and stdout are not available to VB and some other languages.  Bob Denny authored the WinCGI specification to overcome this limitation.

The above sample is 100% VB code.  "Send" is a public sub in the cgi32.bas module.  The above sample isn't a script.
Avatar of jfl

ASKER

VB5CGI can use stdin and stdout.

That's why I'm interested in that.
http://ourworld.compuserve.com/homepages/stsch/VB5-CGI.htm
I wasn't aware of this possibility; however, you did say "cgi32.bas", and you did say "Yes, I'm referring to Bob Denny's WinCGI".

WinCGI and Standard CGI are completely different in their implementation.  I gave you what you asked for, which was quite a bit for 10 points.  Everything is perfectly accurate which I think you know since you've already worked with WinCGI (which I was unaware of until your last rejection).

What would have you expected?
Avatar of jfl

ASKER

Sorry, I'm not rich in points!

Can you help me with this? VB5CGI and cgi32.bas ?
Avatar of jfl

ASKER

Sorry, I'm not rich in points!

Can you help me with this? VB5CGI and cgi32.bas ?
Give me a bit to download and take a look at the stuff.
Avatar of jfl

ASKER

Thanks a lot!

Jacob :)
Post your email address, I've got it working somewhat.  It crashes though.  I'm currently isolating the cause of the crash.
The sample app works "as is" in the documentation.  I set it up and it works great.  The only problem is that is the GetHitCounterInc method hangs.  After awhile, it gives up and terminates (just appeared to be a crash).  After checking into the problem I found it's trying to record hits in the registry.  The help file gives the key under which the hits are supposedly recorded but... after running it, the key wasn't created.  When I removed the GetHitCounterInc method from the sample, everything else worked like a charm.

The project compiled into only 8KB and is faster then WinCGI.

PS: I reported the bug to the object authors.

Avatar of jfl

ASKER

Do you think that it is possible to use both VB5CGI and Bob Denny's cgi32.bas ?
Avatar of jfl

ASKER

Do you think that it is possible to use both VB5CGI and Bob Denny's cgi32.bas ?

I thought that one could just change the Send function in cgi32.bas to use VB5CGI
No, two completely different methods.  I think I know where you're getting at.  I'm not going to bother to redo any of my existing website because they both do the exact same thing and I’m not experiencing a speed problem right now.

But in future development, I'll probably utilize the VB5CGI because I won't need the ISAPI extension and it is faster because it eliminates the overhead of writing all the data to ini files before executing the script (and then reading the ini files from the CGI.exe).

Review the your rejected answer above to see the differences in WinCGI and CGI.  You could modify your code from WinCGI to CGI, but once you do, you won't need the cgi32.bas code because It is replaced by the VB5CGI object.  You must go one way or the other.

ASKER CERTIFIED SOLUTION
Avatar of mrmick
mrmick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfl

ASKER

I know that you have provided me with lots of help for my 10 points and I do appreciate it.

My question was:
How do I both use cgi32.bas and VB5CGI?

And now you tell me I can't, so now you have answered!
please don't talk vb5cgi and wincgi, use Visual Interdev from
microsoft, the active server page  has all objects you want in
VB5CGI and WINCGI