The Wapapi API
This page contains the complete Wapapi API as well as
function declarations for PowerBuilder and Delphi.
StartServing
Description:
This function starts up Wapapi, and starts accepting web requests.
Pass it a handle to a window and an event number for that window.
All web requests will trigger this event on the window. The port number
should either 80 or higher than 80 if you are using Wapapi with another
server. The IP address is used only on NT servers that have multiple
IP addresses, otherwise pass '0.0.0.0' for this parameter.
Usage:
This function should be called from the open event of your window.
Delphi Declaration:
function StartServing(winhandle :word; imessage :integer; pipaddress :pchar; iport :integer) :integer; stdcall; external 'wapapi.dll';
PB Declaration:
function int StartServing(uint winhandle, int imessage, string sipaddress, int iport) LIBRARY 'Wapapi';
StopServing
Description:
This function will stop Wapapi from responding to web requests and
closes the Wapapi DLL.
Usage:
This function should be called when your window is about to close.
Delphi Declaration:
function StopServing :integer; far; stdcall; external 'wapapi.dll';
PB Declaration
function int StopServing() LIBRARY 'Wapapi';
GetDocName
Description:
This function returns the name of the document that is currently
being requested.
Usage:
This function should be called from the event on your window that is
responding to web requests. The string: sDoc must be allocated
before calling this function. user StrAlloc in Delphi or assign
it as Space(255) in Powerbuilder. The iParms parameter returns the
number of parameters that were passed with the document (used with
HTML forms). Use the GetParm function to return the values of
these parameters.
Delphi Declaration:
function GetDocName(pDoc :pchar; var iParms :integer) :integer; stdcall; external 'wapapi.dll';
PB Declaration:
function int GetDocName(ref string sDoc, ref int iParms) LIBRARY 'Wapapi';
GetParm
Description:
This function is used to get parameters that were passed with a document
as part of an HTML form being submitted. Pass it the parameter number
to retrieve, and the name of the parameter and the parameter's value will
be returned.
Usage:
Call this function after a GetDocName function call that indicates that
parameters have been passed. Pre-allocate the parm name and parm value
strings before making the call.
Delphi Declaration:
function GetParm(liParmNumber :integer; lpParmNames, lpParmValues :pchar) :integer; far; stdcall; external 'wapapi.dll';
PB Declaration:
function int GetParm(int iParmNumber, ref string sParmName, ref string sParmValue) LIBRARY 'Wapapi';
SendDocument
Description:
This function is used to send an HTML document or
a graphics file from your local disk to the web requestor. It sends
the file and then closes the request.
Usage:
Just call this function with the desired file. Wapapi will search
for the file in the directory designated in the Wapapi.INI file.
Delphi Declaration:
function SendDocument(pDocName :pchar) :integer; far; stdcall; external 'wapapi.dll';
PB Declaration:
function int SendDocument(ref string sDocName) LIBRARY 'Wapapi';
BufferText
Description:
This function is used to add text to a buffer in Wapapi. This
buffer will later be sent as a complete document when the SendText
function is called.
Usage:
Use this function to build a document in Wapapi's buffer space.
You can buffer as much text as your computer has memory, but keep
each string passed to 64k or below.
Delphi Declaration:
function BufferText(pText :pchar) :integer; far; stdcall; external 'wapapi.dll';
PB Declaration:
function int BufferText(ref string sText) LIBRARY 'Wapapi';
SendText
Description:
This function sends whatever is in Wapapi's buffer space to
the web requestor and closes the request.
Usage:
Use this call as the last line in your window that
processes web requests, after you have built the document using the
BufferText function.
Delphi Declaration:
function SendText :integer; far; stdcall; external 'wapapi.dll';
PB Declaration:
function int SendText() LIBRARY 'Wapapi';