Power Page v1.11
Copyright by Ron Tanner, 1995 / All rights reserved.
Compuserve# 75170,776
Internet:   75170.776@compuserve.com

What is Power Page?
-------------------

Power Page is a Windows DLL that allows you to send Alpha-numeric
(full text) messages to pagers.  You can integrate the power of paging
into your application easily with a single function call from virtually
any language including:

     PowerBuilder
     Microsoft Access
     FoxPro 
     Dbase for Windows
     C / C++
     Paradox for Windows
     Visual Basic
	  Delphi
     or any language or tool that supports calling DLL functions.

A DOS Version with CLIPPER / C examples is available separately.

The DLL function is defined as follows:
  send_alpha_page(port, baud, modem_init_str, modem_dial_str,
                  access_number, pager_id, max_chars_per_blk,
                  msg, debug_file, retmsg)

Alternatively, you may use the extended call:  (REGISTERED VERSION ONLY)
  PowerPage(port, baud, modem_init_str, modem_dial_str,access_number,
            pager_id, max_chars_per_blk, msg, debug_file, retmsg,
            line1, line2, line3, minimize)

By making this simple call, you can send a message to anyone anywhere.

NOTE:  THE UNREGISTERED VERSION OF THIS SOFTWARE LIMITS THE MESSAGE
       TO 40 CHARACTERS.  THE REGISTERED VERSION ALLOWS FOR AN UNLIMITED
       MESSAGE SIZE.

You could use Power Page to:
     Send Time-critical information.
     Notify support technicians of an error or warning.
     Integrate messaging into your application.
     Send alerts or reminder notes. (Wake up calls)
     Send scheduling or meeting notices.
     Provide customers an easy way to ask technical support questions.
     Integrate with dispatch applications.

Power Page makes paging integration a cinch!


What is required?
-----------------

  Microsoft Windows 

  POWERPG.DLL installed in a directory on your path or the 
  \WINDOWS\SYSTEM directory.

  A modem and phone line connected to the computer (COM1 - COM4)

  In addition, you will need to know some information about the
  paging company and pager of the person you wish to send a message to.
  This is described later.


What does it cost?  (and ORDER information)
-------------------------------------------

UNREGISTERED USERS:
     This is not free software. The license allows you to use this software 
     for evaluation purposes without charge for a period of 20 days.  If you 
     use this  software after the 20 day evaluation period a registration fee 
     is required. 

The cost of a licenses of Power Page is $25 (US) per license.  A license is
for a single computer per the licensing terms stated below.  An unlimited
royalty-free distribution license with source code is $300 (US).

Quantity discounts, site licenses, or custom modifications are also 
available by contacting the author:

     Ron Tanner
     4955 E. Preserve Court
     Greenwood Village, CO  80121
     Phone: 303-689-0720
     Fax: 303-689-0730
     Compuserve# 75170,776

To order, please call the author at the above number.  Charge cards are
accepted. (Visa / MasterCard)

You may also charge it to your compuserve account. Just GO SWREG and  
enter registration id# 4920.  You will receive your registered 
version of the Power Page DLL via Compuserve e-mail within 48 hours.

UNREGISTERED USERS:
     Please see the file ORDER.TXT for more information on how to order.


What is the difference between the registered and unregistered version?
-----------------------------------------------------------------------

The registered version offers the following enhancements:

1.  The 40 character message limitation has been lifted.  You can send
    a message up to 1000 characters long.  If the message is bigger
    than the maximum characters per block limit of your paging company, then
    Power Page will split the message up into multiple pages.

2.  You may send multiple messages per call.  For example, if you want
    to send a message to all the salesmen, this is possible now with
    one phone call.  You do this by passing several pager id's and one or
    several messages separated by the ^ (shift-6) character.

3.  There is another function call in the DLL called PowerPage() that
    has enhancements that allow you to control the pop up display.  You
    have 4 more parameters.  The first three, you may pass text to be
    displayed in the window (Rather than my annoying copyright).  The 
    last parameter lets you run the power page window minimized to an
    icon.  Please see the description of the PowerPage() below
    documentation for more information.


How do I Install Power Page?
----------------------------

To install Power Page, simply copy the POWERPG.DLL file to the 
\WINDOWS\SYSTEM directory.


What do I need to know about the Pager?
---------------------------------------

The only thing you need to know about the pager is the pager phone
number or the Pager ID.  For example, I have a Motorola Advisor on
Interlink Communications of Colorado.  The phone number to my pager
is 8260590. (Do not pass a dash in the phone number when you call the 
function)

You will need to know the following about the paging company of the
pager. (In my case, the paging company is Interlink Communications):

1.  Access Number.  You will need to know the paging terminals 
    alphanumeric paging access telephone number.  This is the phone
    number of the modem at the paging company that will receive the
    message using the TAP protocol.  This number is the same for
    everybody that has a pager from that company.  In my case, Interlink's
    access phone number is 303-799-0055.  Many carriers will offer
    800 numbers - especially the nationwide guys like SkyPage or Mobilcomm.

2.  The baud rate.  You need to know the paging company's modem baud
    rate associated with the access number.  Believe it or not, most
    access modems still receive alphanumeric messages at 300 baud.
    Many have "upgraded" to 2400 baud.  It doesn't really matter that
    much what rate they have - pager messages tend to be relatively short
    so the speed of transfer is not really that important.

3.  Characters per message block.  Most paging carriers limit how many
    characters can be sent in one message.  A lot of carriers limit the
    message size to 80 characters.  Many others have expanded their 
    service to 230 characters per message.  The size of message really
    becomes a factor of the carrier.  You will need to find out this
    information or learn this through trial and error.

4.  Password?  Does your paging carrier require a password.  Most US 
    companies DO NOT.  In this case, Power Page sends six zeros as the
    password.  This is the standard way of doing it.  If do require a
    special password, see the note under "access number" below.

    REGISTERED USERS NOTE:
    You can send any size of message to Power Page.  Power Page
    will automatically split them up into several messages to fit the
    characters per message block.  Unregistered user's messages are
    chopped off at 40 characters.


What else do I need to know?
----------------------------

You will also need to know what port your modem is connected to.  You
may need to know what kind of modem is attached and perhaps custom
configure it by passing Power Page a modem initialization string.


What is the format of the call?
-------------------------------

There are two functions available in the DLL.
    send_alpha_page()
    PowerPage()  /* Registered Version Only */

--------------------------------------------------------------
 send_alpha_page() Description
--------------------------------------------------------------

The following describes the "send_alpha_page" function call:

Note: All strings must be ASCIIZ strings (Null Terminated)

int send_alpha_page(port,baud,modem_init_str,modem_dial_str,access_number,
                    pager_id,max_chars_per_blk,msg,debug_file,retmsg)

char *port;              /* Port that modem is connected              */
char *baud;              /* Baud rate of the paging company           */
char *modem_init_str;    /* Any special setup string your modem needs */
char *modem_dial_str;    /* Any special dial string your modem needs  */
char *access_number;     /* The paging company's alpha access phone # */
char *pager_id;          /* The pager phone number                    */
char *max_chars_per_blk; /* The paging company's character limit / msg*/
char *msg                /* The message to send to the pager          */
char *debug_file;        /* If you have problems give this a file name*/
char *retmsg;            /* The return message of how it went         */

Parameter                Description
-------------------------------------------------------------------------
port                     Specifies the port that your modem is connected 
                         to.  This can be "COM1" through "COM4"

baud                     Specifies the baud rate that the paging company's
                         alpha access port communicates at.  This can
                         be any of the following: "300", "1200", "2400",
                         "4800", "9600", "19200".  In very rare cases,
                         I have seen the paging terminal require N,8,1
                         rather than E,7,1. (Parity, data bits, stop bits)
                         If this is the case, preceed the baud rate
                         with an N. (ie "N300")

modem_init_str           Start off by leaving this string NULL.  If the 
                         value is NULL, Power Page will send your modem
                         an AT + a return.  The modem must then
                         respond with an "OK".  If the default doesn't
                         work, you will need to find the modem's manual
                         and figure out a string that will work.  Any
                         time you need a <cr> replace it with the tilde
                         character (~) (ie. AT&F~)  If you need to pause,
                         the hat character (^) will give you a 1 second
                         pause. (ie. AT&F~^^AT~)  The maximum length of
                         the modem initialization string is 80 characters.

modem_dial_str           Start off by leaving this string NULL.  If the
                         value is NULL, Power Page will send your modem 
                         an ATDT when it is ready to dial.  If only pulse
                         dialtone is available, you will have to pass
                         "ATDP" in this parameter.


access_number            This is the telephone number for the paging
                         company's modem that receives alphanumeric
                         messages.  THIS IS DIFFERENT FROM THE PAGER
                         TELEPHONE NUMBER.  You may include dashes and
                         comma's like any other modem phone number. 
                         (A comma usually pauses 2 seconds - ie 9,444-4444)
                         (See above for more information)

                         Note: For those paging carriers that require
                         a specific password, this is where you put it.
                         After the access phone number place the ^ hat
                         character (shift 6) and then place the password.
                         For example, if the paging carrier required the
                         password of L23456, then the access_number string
                         would be: access_number$="9,444-4444^L23456"

                         By putting "DIRECT" in this string, Power Page
                         assumes a direct connection.  No dialing takes
                         place and DTR is NEVER dropped.

pager_id                 This is usually the pager's phone number or 
                         PIN number.  DO NOT INCLUDE ANY DASHES in this
                         number.

                         You may send multiple pages with one phone call.
                         You do this by separating the pager_id's and 
                         messages by the ^ (hat - shift 6) character.  For
                         example, if I wanted to send myself two messages,
                         I would set pager_id="8260590^8260590" and the
                         msg field to msg="This is message 1.^This is 
                         message 2".  Note: that there had better be the
                         same number of ^ characters in the pager_id 
                         field as there is in the message field.

max_chars_per_blk        This is the number of characters the paging 
                         company allows per message block.  This number
                         varies widely from company to company.  Some
                         are as small as 60 characters and some are as
                         big as 1000 characters.  The norms seem to be
                         80 and 230 characters per block.  If the message
                         you pass is bigger than the character per block
                         limitation, Power Page automatically splits your
                         message up into multiple blocks, so the recipient 
                         gets the entire message. (Registered version only)
                         However, he/she does get a different page for 
                         each block. (See above for more information)

msg                      This is the message that goes to the pager.  The
                         un-registered version truncates this message to
                         40 characters.

                         Please note that you may send multiple messages
                         separated by the ^ (hat - Shift 6) character.
                         Please see pager_id description above for more
                         information.  If you want to send the same
                         message to the entire list of pagers, insert
                         the single message and terminate it with ^^.
                         (i.e. Msg$="Test Page^^")

debug_file               Normally, this parameter is NULL.  In the event
                         you are having trouble successfully completing 
                         a page, specify a valid file name for this
                         parameter.  Power Page will append to the end
                         of the file some information on where the 
                         problem is.  This file will also help me to
                         determine where the problem is if you want to 
                         E-Mail me the file.

retmsg                   This is a string returned by Power Page telling 
                         you what happened during the call.  See below
                         for a complete description of the possible values
                         in this string.  Make sure you pre-allocate 100
                         bytes for this string BEFORE you make the function
                         call.

--------------------------------------------------------------
 PowerPage() Description    REGISTERED VERSION ONLY
--------------------------------------------------------------

The following describes the "PowerPage" function call:

int PowerPage(port,baud,modem_init_str,modem_dial_str,access_number,
              pager_id,max_chars_per_blk,msg,debug_file,retmsg,
              line1,line2,line3,minimize)

Note: All strings must be ASCIIZ strings (Null Terminated)

char *port;              /* Port that modem is connected              */
char *baud;              /* Baud rate of the paging company           */
char *modem_init_str;    /* Any special setup string your modem needs */
char *modem_dial_str;    /* Any special dial string your modem needs  */
char *access_number;     /* The paging company's alpha access phone # */
char *pager_id;          /* The pager phone number                    */
char *max_chars_per_blk; /* The paging company's character limit / msg*/
char *msg                /* The message to send to the pager          */
char *debug_file;        /* If you have problems give this a file name*/
char *retmsg;            /* The return message of how it went         */
char *line1;             /* The text to display on line 1 of the box  */
char *line2;             /* The text to display on line 2 of the box  */
char *line3;             /* The text to display on line 3 of the box  */
char *minimize;          /* Y to minimize window initially            */

Parameter                Description
-------------------------------------------------------------------------
port                     Specifies the port that your modem is connected 
                         to.  This can be "COM1" through "COM9"

baud                     Specifies the baud rate that the paging company's
                         alpha access port communicates at.  This can
                         be any of the following: "300", "1200", "2400",
                         "4800", "9600", "19200".  In very rare cases,
                         I have seen the paging terminal require N,8,1
                         rather than E,7,1. (Parity, data bits, stop bits)
                         If this is the case, preceed the baud rate
                         with an N. (ie "N300")

modem_init_str           Start off by leaving this string NULL.  If the 
                         value is NULL, Power Page will send your modem
                         an AT + a return.  The modem must then
                         respond with an "OK".  If the default doesn't
                         work, you will need to find the modem's manual
                         and figure out a string that will work.  Any
                         time you need a <cr> replace it with the tilde
                         character (~) (ie. AT&F~)  If you need to pause,
                         the hat character (^) will give you a 1 second
                         pause. (ie. AT&F~^^AT~)  The maximum length of
                         the modem initialization string is 80 characters.

modem_dial_str           Start off by leaving this string NULL.  If the
                         value is NULL, Power Page will send your modem 
                         an ATDT when it is ready to dial.  If only pulse
                         dialtone is available, you will have to pass
                         "ATDP" in this parameter.


access_number            This is the telephone number for the paging
                         company's modem that receives alphanumeric
                         messages.  THIS IS DIFFERENT FROM THE PAGER
                         TELEPHONE NUMBER.  You may include dashes and
                         comma's like any other modem phone number. 
                         (A comma usually pauses 2 seconds - ie 9,444-4444)
                         (See above for more information)

                         Note: For those paging carriers that require
                         a specific password, this is where you put it.
                         After the access phone number place the ^ hat
                         character (shift 6) and then place the password.
                         For example, if the paging carrier required the
                         password of L23456, then the access_number string
                         would be: access_number$="9,444-4444^L23456"

                         By putting "DIRECT" in this string, Power Page
                         assumes a direct connection.  No dialing takes
                         place and DTR is NEVER dropped.

pager_id                 This is usually the pager's phone number or 
                         PIN number.  DO NOT INCLUDE ANY DASHES in this
                         number.

                         You may send multiple pages with one phone call.
                         You do this by separating the pager_id's and 
                         messages by the ^ (hat - shift 6) character.  For
                         example, if I wanted to send myself two messages,
                         I would set pager_id="8260590^8260590" and the
                         msg field to msg="This is message 1.^This is 
                         message 2".  Note: that there had better be the
                         same number of ^ characters in the pager_id 
                         field as there is in the message field.
                          
max_chars_per_blk        This is the number of characters the paging 
                         company allows per message block.  This number
                         varies widely from company to company.  Some
                         are as small as 60 characters and some are as
                         big as 1000 characters.  The norms seem to be
                         80 and 230 characters per block.  If the message
                         you pass is bigger than the character per block
                         limitation, Power Page automatically splits your
                         message up into multiple blocks, so the recipient 
                         gets the entire message. (Registered version only)
                         However, he/she does get a different page for 
                         each block. (See above for more information)

msg                      This is the message that goes to the pager.  The
                         un-registered version truncates this message to
                         40 characters.

                         Please note that you may send multiple messages
                         separated by the ^ (hat - Shift 6) character.
                         Please see pager_id description above for more
                         information.  If you want to send the same
                         message to the entire list of pagers, insert
                         the single message and terminate it with ^^.
                         (i.e. Msg$="Test Page^^")

debug_file               Normally, this parameter is NULL.  In the event
                         you are having trouble successfully completing 
                         a page, specify a valid file name for this
                         parameter.  Power Page will append to the end
                         of the file some information on where the 
                         problem is.  This file will also help me to
                         determine where the problem is if you want to 
                         E-Mail me the file.

retmsg                   This is a string returned by Power Page telling 
                         you what happened during the call.  See below
                         for a complete description of the possible values
                         in this string.  Make sure you pre-allocate 100
                         bytes for this string BEFORE you make the function
                         call.

line1                    This is the first line of the Power Page Window.
                         If this parameter is NULL or empty, "Power Page"
                         will be displayed.  It is up to you to add
                         preceeding spaces in order to center the text.

line2                    This is the second line of the Power Page Window.
                         If this parameter is NULL or empty, my copyright
                         will be displayed.  It is up to you to add
                         preceeding spaces in order to center the text.

line3                    This is the third line of the Power Page Window.
                         If this parameter is NULL or empty, "Registerd
                         Version" will be displayed on this line.  It is up
                         to you to add preceeding spaces in order to center
                         the text.

minimize                 If the first character in this string is "Y" then
                         the power page window will not be displayed.  The
                         window is minimized to an icon, so you will see
                         the icon while it is active.  The icon disappears
                         after the call is complete.



--------------------------------------------------------------
 Return codes and strings for EITHER function
--------------------------------------------------------------

RETURNS: 0 = Successful
         >0 = Failure or partial failure

The possible values for the retmsg parameters are as follows:

With Return Code of 0: (Success)
     Successful.

With Return Code of >0: (Failure)

Ret Code    Retmsg
 1          Operator interrupted session.
 2          Could not create window.
 3          Could not create windows timer.
 4          The number of pager id's does not match the number of messages.
 5          OpenComm Error - The device identifier is invalid or unsupported.
 6          OpenComm Error - The devices baud rate is unsupported.
 7          OpenComm Error - Byte size error.
 8          OpenComm Error - The default parameters are in error.
 9          OpenComm Error - The hardware is not available
                 (is locked by another device).
10          OpenComm Error - The function cannot allocate memory for the COM queues.
11          OpenComm Error - The device is not open.
12          OpenComm Error - The COM port is already open.
13          OpenComm Error - Unknown error.
14          OpenComm Error - Error on BuildCommDCB command.
15          OpenComm Error - Error on SetCommState command.
16          CloseComm Error.
17          Your modem on COMx did not respond to the following
                 init string: <passed init string>
18          Timeout waiting for CONNECTion.
19          Lost Connection during call.
20          Timeout waiting for ID=.
21          Timeout waiting for goahead string.
22          Lost Connection during call.
23          Block was NAK'd five times.
24          XX Invalid Pager ID's - Bad List: XX XX .. XX .
            Note: This error occurs if at least one of the pager ID's are
                  invalid.  A pager could be invalid if it is an incorrect
                  pager ID or the pager has been turned off - such as when
                  a customer stops service.

                  Since Power Page supports sending several messages in
                  a single phone call, Power Page will attempt to send
                  all the messages that you have sent - even if one of
                  pager numbers is no longer valid.

                  This error message will return the number of messages
                  that were bad - along with the list of which messages
                  failed.

                  For example, If I sent the following:
                     pager_id$="8260590^6666666^8260590"
                     msg$="One,One^Two,Two^Three,Three"
                  and assuming 6666666 was not valid in the paging terminal,
                  I would get the following return:

                  01 Invalid Pager ID's - Bad List: 02 .

                  The 02 refers to which message failed.                               
            
25          The PowerPage function is not supported in the unregistered version.
26				You passed a zero length message.
27				You passed a zero block limit.
28          Returning with init error - The PowerPage DLL is busy

EXAMPLE calls
-------------
 
  The setup and call from your favorite language would be similar to
  how you would make a call to a Windows API (SDK) function.  Some
  specific examples follow:

---------------------------------------------------------------------
    send_alpha_page() function examples
---------------------------------------------------------------------

  PowerBuilder Examples 
  ---------------------
  
  Declare a Global External function as follows:
      FUNCTION int send_alpha_page(ref string port, ref string baud, &
               ref string modem_init_str, ref string modem_dial_str, &
               ref string access_number, ref string pager_id, &
               ref string max_chars_per_blk, ref string msg, &
               ref string debug_file, ref char retmsg[100]) &
               LIBRARY "POWERPG.DLL"

  A sample script to setup and send a page:
     int rc
     char retmsg[100]
     string port,baud,modem_init_str,modem_dial_str
     string access_number,pager_id,max_chars_per_blk,msg,debug_file

     port="COM1"
     baud="300"
     modem_init_str=""
     modem_dial_str=""
     access_number="799-0055"
     pager_id="8260590"
     max_chars_per_blk="80"
     msg="Hello, This is a test page."
     debug_file=""

     rc=send_alpha_page(port,baud,modem_init_str,modem_dial_str, &
          access_number,pager_id,max_chars_per_blk,msg,debug_file,retmsg)

     MessageBox("Power Page Results",retmsg)

  
  VISUAL BASIC or Microsoft Access Example
  ----------------------------------------

  In the declarations area add the following line (put on one line):

Declare Function send_alpha_page Lib "POWERPG.DLL" (ByVal port$, ByVal baud$,
        ByVal modem_init_str$, ByVal modem_dial_str$, ByVal access_number$, ByVal pager_id$,
        ByVal max_chars_per_blk$, ByVal msg$, ByVal debug_file$, ByVal retmsg$) As Integer


  A Sample script to setup and send a page:

port$ = "COM1"
baud$ = "300"
modem_init_str$ = ""
modem_dial_str$ = ""
access_number$ = "7990055"
pager_id$ = "8260590"
max_chars_per_blk$ = "80"
msg$ = "Howdy partner."
debug_file$ = ""
retmsg$ = String$(100, 0)

Rem -- Put the following on one line:
ret% = send_alpha_page(port$, baud$, modem_init_str$, modem_dial_str$, access_number$,
        pager_id$, max_chars_per_blk$, msg$, debug_file$, retmsg$)

MsgBox retmsg$



  C or C++ Example (Tested using Visual C++ 1.5)
  ----------------

int sample_function(void)
{
   char retmsg[100];
   HINSTANCE lh;
   int ret;
   BOOL (FAR pascal *lpfn) (char far *,char far *,char far *,char far *,
                            char far *,char far *,char far *,char far *,
                            char far *, char far *);

   lh=LoadLibrary("POWERPG.DLL");
   if(lh <= HINSTANCE_ERROR) {
      MessageBox(0,"Could Not Load library","Return Status",MB_OK);
      return(0);
   }
   lpfn=(BOOL (FAR pascal *)
        (char far *,char far *,char far *,char far *, char far *,
         char far *,char far *,char far *,char far *, char far *))
        (GetProcAddress(lh,"send_alpha_page"));

   if(lpfn == 0) {
      MessageBox(0,"Could Not Load address","Return Status",MB_OK);
      return(0);
   }

   ret=(*lpfn)("COM1","300","","","7990055","8260590","80",
               "Hello, Test Page","",retmsg);

   FreeLibrary(lh);
   MessageBox(0,retmsg,"Return Status",MB_OK);
   return(0);
}


  FoxPro for Windows Example
  --------------------------

  FoxPro does not allow the 10 required parameters to be passed to a DLL.  
  Therefore, an alternative function has been provided in the DLL to 
  combine 9 of the parameters into one separated by the verticle bar (|).
  The function is called PowerPageCombined(char *parms, char *retmsg)

  The following example may explain:

* For testing purposes, make sure you don't reload FOXTOOLS a million times.
SET LIBRARY TO
* Now load it back in.
SET LIBRARY TO d:\vfp\fOXTOOLS.FLL

* Register the PowerPage function via FOXTOOLS
RN = RegFn("PowerPageCombined","@C@C","I","POWERPG.DLL")

* Initialize the variables
retmsg=SPACE(100)
parms="COM1|300|AT&F~||7990055|8260590|80|Sample Page|test.txt|"

*port|baud|initstring|dialstring|accessnumber|pagerId|maxchars|msg|debugfile

result = CallFn(RN,@parms, @retmsg)
?retmsg



  Borland Delphi Example
  ----------------------

unit Pp;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  implementation

{$R *.DFM}

function Send_Alpha_Page(Port: Pchar; Baud: pchar; ModemInitStr: pchar;
         ModemDialStr: pchar; AccessNumber: pchar; PagerID: pchar;
         MaxCharsPerBlk: pchar; Msg: pchar; DebugFile: pchar;
         RetMsg: pchar): Smallint; far;
         external 'POWERPG.DLL';

procedure TForm1.Button1Click(Sender: TObject);
var
  ret: smallint;
  s: string;

  Port: pchar;
  Baud: pchar;
  ModemInitStr: pchar;
  ModemDialStr: pchar;
  AccessNumber: pchar;
  PagerID: pchar;
  MaxCharsPerBlk: pchar;
  Msg: pchar;
  DebugFile: pchar;
  RetMsg: pchar;

begin

  Port := 'COM2';
  Baud := '300';
  ModemInitStr := '';
  ModemDialStr := '';
  AccessNumber := '4857948^000000';
  PagerID := '9880006^9880006^9880006';
  MaxCharsPerBlk := '80';
  Msg := 'message1^message2^message3';
  DebugFile := '';
  RetMsg := StrAlloc(100);

  ret:= Send_Alpha_Page(Port,Baud,ModemInitStr,ModemDialStr,AccessNumber,
        PagerID,MaxCharsPerBlk,Msg,DebugFile,RetMsg);

  s := StrPas(RetMsg);
  MessageDlg(s, mtInformation,[mbOk], 0);
  StrDispose(RetMsg);
end;

end.


  Paradox for Windows Example
  ---------------------------

  Declare the following in the Uses() method of the form object
  and place the following code in it:

Uses POWERPG
   send_alpha_page(CPTR port, CPTR baud, CPTR modem_init_str, 
                   CPTR modem_dial_str, CPTR access_number, CPTR pager_id,
                   CPTR max_chars_per_blk, CPTR msg CPTR debug_file, 
                   CPTR retmsg) CWORD
EndUses

var
   port String
   baud String
   modem_init_str String
   modem_dial_str String
   access_number String
   pager_id String
   max_chars_per_blk String
   msg String
   debug_file String
   retmsg String
   retVal SmallInt
endvar

port = "COM1"
baud = "300"
modem_init_str = ""
modem_dial_str = ""
access_number = "7990055"
pager_id = "8260590"
max_chars_per_blk = "80"
msg = "Howdy partner."
debug_file = ""
retmsg = Space(100)

retval=send_alpha_page(port, baud, modem_init_str, modem_dial_str,
        access_number,pager_id, max_chars_per_blk, msg, debug_file, retmsg)

MsgInfo("Results",retmsg)


  Objectview Example
  ------------------

DECLARE FUNCTION send_alpha_page%(@port$,@baud$,@modem_init_str$, 
                 @modem_dial_str$,@access_number$,@pager_id$,
                 @max_chars_per_blk$,@msg$,@debug_file$, 
                 @retmsg$) LIB "POWERPG.DLL send_alpha_page"

port$ = "COM1"
baud$ = "300"
modem_init_str$ = ""
modem_dial_str$ = ""
access_number$ = "7990055"
pager_id$ = "8260590"
max_chars_per_blk$ = "80"
msg$ = "Howdy partner."
debug_file$ = ""
FOR I% = 1 to 100
   retmsg$=retmsg$ + " "
NEXT I

ret% = send_alpha_page(port$, baud$, modem_init_str$, modem_dial_str$, access_number$,
        pager_id$, max_chars_per_blk$, msg$, debug_file$, retmsg$)

MESSAGEBOX(retmsg$,"Result",MB_OK)

  
  Dbase for Windows Example
  -------------------------

  EXTERN CINT send_alpha_page(CPTR *,CPTR *,CPTR *,CPTR *,CPTR *,
                              CPTR *,CPTR *,CPTR *,CPTR *,CPTR *)
  

* Initialize variables
port="COM1"
baud="300"
modem_init_str=""
modem_dial_str=""
access_number="7990055"
pager_id="8260590"
max_chars_per_blk="80"
msg="Howdy partner."
debug_file=""
retmsg=SPACE(100)

retval=send_alpha_page(port, baud, modem_init_str, modem_dial_str,
        access_number,pager_id, max_chars_per_blk, msg, debug_file, retmsg)

?retmsg


---------------------------------------------------------------------
    PowerPage() function examples
---------------------------------------------------------------------


  PowerBuilder Examples
  ---------------------
  
  Declare a Global External function as follows:
      FUNCTION int PowerPage(ref string port, ref string baud, &
               ref string modem_init_str, ref string modem_dial_str, &
               ref string access_number, ref string pager_id, &
               ref string max_chars_per_blk, ref string msg, &
               ref string debug_file, ref char retmsg[100], &
               ref string line1, ref string line2, ref string line3, &
               ref string minimize) &
               LIBRARY "POWERPG.DLL"

  A sample script to setup and send a page:
     int rc
     char retmsg[100]
     string port,baud,modem_init_str,modem_dial_str
     string access_number,pager_id,max_chars_per_blk,msg,debug_file
     string line1,line2,line3,minimize

     port="COM1"
     baud="300"
     modem_init_str=""
     modem_dial_str=""
     access_number="799-0055"
     pager_id="8260590^8265555"
     max_chars_per_blk="80"
     msg="Hello, This is a test page.^This is a second message"
     debug_file=""
     line1=""
     line2="   SuperQuick Software"
     line3="  "
     minimize="Y"

     rc=PowerPage(port,baud,modem_init_str,modem_dial_str, &
          access_number,pager_id,max_chars_per_blk,msg,debug_file,retmsg, &
          line1,line2,line3,minimize)

     MessageBox("Power Page Results",retmsg)

  
  VISUAL BASIC or Microsoft Access Example
  ----------------------------------------

  In the declarations area add the following line (put on one line):

Declare Function PowerPage Lib "POWERPG.DLL" (ByVal port$, ByVal baud$,
        ByVal modem_init_str$, ByVal modem_dial_str$, ByVal access_number$,
        ByVal pager_id$, ByVal max_chars_per_blk$, ByVal msg$,
        ByVal debug_file$, ByVal retmsg$, ByVal line1$, ByVal line2$,
        ByVal line3$, ByVal minimize$ ) As Integer


  A Sample script to setup and send a page:

port$ = "COM1"
baud$ = "300"
modem_init_str$ = ""
modem_dial_str$ = ""
access_number$ = "7990055"
pager_id$ = "8260590^8261234"
max_chars_per_blk$ = "80"
msg$ = "Howdy partner.^This is a second message"
debug_file$ = ""
retmsg$ = String$(100, 0)
line1$=""
line2$="   SuperQuick Software"
line3$="  "
minimize$="Y"

Rem -- Put the following on one line:
ret% = PowerPage(port$, baud$, modem_init_str$, modem_dial_str$, access_number$,
                 pager_id$, max_chars_per_blk$, msg$, debug_file$, retmsg$,
                 line1$,line2$,line3$,minimize$)

MsgBox retmsg$

  FoxPro for Windows Examples
  ---------------------------
  FoxPro does not allow the 14 required parameters to be passed to a DLL.  
  Therefore, an alternative function has been provided in the DLL to 
  combine 13 of the parameters into one separated by the verticle bar (|).
  The function is called PowerPageCombined(char *parms, char *retmsg)

  Note: The PowerPageCombined() function supports both the shorter
        send_alpha_page() parameters and the long PowerPage() parameters.

  The following example may explain:

* For testing purposes, make sure you don't reload FOXTOOLS a million times.
SET LIBRARY TO
* Now load it back in.
SET LIBRARY TO d:\vfp\fOXTOOLS.FLL

* Register the PowerPage function via FOXTOOLS
RN = RegFn("PowerPageCombined","@C@C","I","POWERPG.DLL")

* Initialize the variables
retmsg=SPACE(100)
parms="COM1|300|AT&F~||7990055|8260590|80|Sample Page|test.txt|
       My Program|SuperRad Inc.| |Y|"

*port|baud|initstring|dialstring|accessnumber|pagerId|maxchars|msg|debugfile|
*line1|line2|line3|minimize
result = CallFn(RN,@parms, @retmsg)
?retmsg


LEGAL MATTERS
-------------

 Of course the usual disclaimers still apply.  We are not 
 responsible for anything at all.  Nothing.  Even if we are held
 responsible, the limit of our liability is the licensing fees
 you paid. 


SHAREWARE LICENSE - END USER
----------------------------

 The Power Page software is not and has never been public
 domain software, nor is it free software. 

 Non-licensed users are granted a limited license to use our
 software on a 20-day trial basis for the purpose of determining
 whether the software is suitable for their needs.  Any use
 of our software, except for the initial 20-day trial, requires
 registration.  The use of unlicensed copies of our software,
 outside of the initial 20-day trial, by any person, business,
 corporation, government agency or any other entity is
 strictly prohibited. 


 SHAREWARE LICENSE - FOR DISTRIBUTION OF SHAREWARE FILES,
 USER GROUPS, BBS's, ONLINE SERVICES, SHAREWARE VENDORS, and
 OTHERS

 A limited license is granted to copy and distribute our
 shareware software only for the trial use of others, subject to
 the following limitations:

  1)    The software must be copied in unmodified form, complete
        with the file containing this license information.

  2)    The full machine-readable documentation must be included
        with each copy.

  3)    Our software may not be distributed in conjunction with
        any other product with out a specific license to do so
        from Ron Tanner.

  4)    Vending of our software products in retail stores (by
        "shareware rack vendors") is specifically prohibited
        without prior written authorization.

  5)    No fee, charge, or other compensation may be requested
        or accepted, except as authorized below:

     A) Non-profit user groups may distribute copies of the our
        products to their members, subject to the above
        conditions, without specific permission.  Non-profit
        groups may collect a disk duplication fee not to exceed
        five dollars.

     B) Operators of electronic bulletin board systems (sysops)
        may make our products available for downloading only as
        long as the above conditions are met.  An overall or
        time-dependent charge for the use of the bulletin board
        system is permitted as long as there is not a specific
        charge for the download of our software.

     C) Mail-order vendors of shareware software
        may distribute our products, subject to the
        above conditions, without specific permission.
        Vendors may charge a disk duplication and handling
        fee, which, when pro-rated to each individual product,
        may not exceed eight dollars.


 LICENSED COPIES OF OUR SOFTWARE ARE GOVERNED BY THE FOLLOWING:
---------------------------------------------------------------

 THIS SOFTWARE IS NOT FOR SALE: The software  is 
 subject to the following license terms and conditions.  

 SOFTWARE LICENSE granted, when required fees paid,
 by Ron Tanner, with its mailing address at 4955 E. Preserve Court,
 Greenwood Village, CO  80121.  The software contained in this 
 package is licensed to you as the end user.  It is not sold.

 LICENSE:
         1.0  The software contained in this package 
 (hereafter referred to as "the Software") is copyrighted 
 material owned by Ron Tanner.  Payment of the single copy
 license fee authorizes one named person to use the Software
 on one computer provided this copyright is not violated and
 provided the rules outlined herein are observed.

         1.1  One person may use the Software on any 
 single computer. This license can be transferred only once 
 in any twenty-four hour period. You must pay for additional 
 copies of the Software if more than one person uses it at 
 one time, or if the Software is used on two or more 
 computers. Neither concurrent use on two or more 
 computers, nor use by more than a single individual on a 
 network is permitted without authorization and payment of 
 other license fees.

         1.2  You may make copies of the software for 
 backup purposes, as long as all such copies, along with 
 the original, are kept in your possession or control.

         1.3  You may not make any changes or modifications to
 the Software, including, but not limited to, decompiling,
 disassembling, or otherwise reverse engineering it.  You may
 not rent or lease it to others.  You may not use it on a
 computer network if more than one user can use it on more than
 one computer during any one twenty-four hour span of time.


  LIMITED WARRANTY
------------------

  Ron Tanner guarantees your satisfaction with this
  product for a period of 90 days from the date of original
  purchase.  If you are unsatisfied with the product
  within that time period, return the package in salable
  condition to the place of purchase for a full refund.

  Ron Tanner warrants that all disks provided are
  free from defects in material and workmanship, assuming
  normal use, for a period of 90 days from the date of
  purchase.

  Ron Tanner warrants that the program will perform
  in substantial compliance with the documentation supplied
  with the software product.  If a significant defect in
  the product is found, the purchaser may return the
  product for a refund.  In no event will such a refund
  exceed the purchase price of the product.


  EXCEPT AS PROVIDED ABOVE, RON TANNER DISCLAIMS ALL
  WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
  LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND
  FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE
  PRODUCT.  SHOULD THE PROGRAM PROVE DEFECTIVE, THE
  PURCHASER ASSUMES THE RISK OF PAYING THE ENTIRE COST OF
  ALL NECESSARY SERVICING, REPAIR, OR CORRECTION AND ANY
  INCIDENTAL OR CONSEQUENTIAL DAMAGES.  IN NO EVENT WILL
  RON TANNER BE LIABLE FOR ANY DAMAGES WHATSOEVER
  (INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF
  BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
  INFORMATION AND THE LIKE) ARISING OUT OF THE USE OR THE
  INABILITY TO USE THIS PRODUCT EVEN IF RON TANNER
  HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

  Use of this product for any period of time constitutes
  your acceptance of this agreement and subjects you to its
  contents.


  TRADEMARKS
------------

  Microsoft and MS-DOS are registered trademarks of
  Microsoft Corporation.
  Windows is a trademark of Microsoft Corporation.


Revision History
----------------

1.07 - 17 Apr 1995

There was a bug when sending multiple messages.  If you sent more than
two messages at a time, you would get a message saying the number of pager
id parameters didn't match the number of message parameters.  This was
corrected.

1.08 - 20 Apr 1995

When sending multiple messages in a single call, and one of the messages
contained a bad pager ID (customer cancelled his service), the remaining
messages would not be sent.  I changed the way this worked.  All the messages
are attempted and a list is returned on which ones failed - if any.
(See return codes above for more information)

1.09 - 8 May 1995

Sometimes you want to send the same message to a group.  Before this version
you had to send the list of pagers in page_id (i.e. 8254444^8254445^9234444)
and you also had to repeat the message the same number of times
(i.e. Test Page^Test Page^Test page).  The msg$ string now supports the 
use of ^^ which indicates to Power page to send the same string to every
pager in the list. (i.e. Test Page^^)

Power Page replaces the ^ with Nulls as it works with it.  In prior versions
this would modify the actual string passed by the application so when the
function returned, the string wasn't the same as before.  This caused some
confusion - especially for someone who wanted to re-submit the same string
again.  Power Page now allocates its own work space for the msg$ and 
pager_id$ strings.

1.10 - 10 May 1995

Added the DIRECT connect capability.  This is done by putting the string
"DIRECT" into the access_number$ variable.  Added Version to the resource
file.  This can be read by using the file manager and ALT-ENTER which
shows DLL properties.  This is also used by the Setup command to verify
program/dll version collisions.  Added Error message 28 - DLL is busy.
This was done as the DLL is not protected fro re-entrancy and would blow
up if the DLL function was called again prior to completing the call.  Code
was added within the DLL to set and clear the status.  The CloseComm 
error checking was removed.  If more than one com port was opened from
another application, the CloseComm() Windows SDK would return an error.
Therefore, error checking was removed.  Also, fixed the access_number$ 
password option so that if you put a ^ at the end of the string and then
no password, it will eliminate the sending of the 000000 after the PG1.

1.11 - 23 May 1995

Changed the run minimized function to run more in the background rather
than getting the focus.  Changed the setmodem function to be multitasking
and not hold the machine while waiting for pauses.  Merged DOS build into
one source module to make it easier to maintain.


