_Writing ActiveX ISAPI Extensions_ by Al Williams Example 1: Public Sub VBISAPI(server as Object) . . . End Sub Example 2: Click to begin Example 3: (a) Dim x as Variant server.ServerVariable "HOST_NAME",x server.Write x server.ServerVariable "SCRIPT_NAME",x server.Write x (b) Dim x as Variant Dim y as Variant server.ServerVariable "HOST_NAME",x server.ServerVariable "SCRIPT_NAME",y server.Write x & y Example 4: Dim s as String s=server.ParsedQueryString("HI") Example 5: (a) <% EntryTime = now Validated = False %> (b) Logged on since <%= EntryTime %> (c) <% if Validated then %> Data Entry Successful! <% end if %> Listing One VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "DLL" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit Private Sub svrerr(server As Object, errstr As String) server.WriteLine "Error: " & errstr server.statcode = 400 server.retval = 4 End Sub Private Sub Win(server As Object) server.WriteLine "
" server.ServerVariable "SERVER_NAME", servername server.ServerVariable "SCRIPT_NAME", script server.WriteLine "Is my guess:
" server.Write "
" server.WriteLine "" End Sub Public Sub Guess(server As Object) Dim Guess As Long Dim Hi As Long Dim Lo As Long Dim pos As Long Dim ans As String pos = InStr(1, server.QueryString, "HI=", vbTextCompare) If pos = 0 Then svrerr server, "Can't find HI" Exit Sub End If Hi = Val(Mid(server.QueryString, pos + 3)) pos = InStr(1, server.QueryString, "LO=", vbTextCompare) If pos = 0 Then svrerr server, "Can't find LO" Exit Sub End If Lo = Val(Mid(server.QueryString, pos + 3)) If server.ContentLength = 0 Then GuessAgain server, Hi, Lo Else Guess = (Hi + Lo) / 2 pos = InStr(1, server.Content, "ANSWER=", vbTextCompare) If pos = 0 Then svrerr server, "Form error" Exit Sub End If ans = Mid(server.Content, pos + 7, 2) If ans = "OK" Then Win server If ans = "LO" Then GuessAgain server, Hi, Guess If ans = "HI" Then GuessAgain server, Guess, Lo If ans <> "OK" And ans <> "LO" And ans <> "HI" Then svrerr server, "Unknown Response: " & server.Content End If End Sub Listing Two