Difference: CallingWindowsAPIFunctions (4 vs. 5)

Revision 52016-04-19 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="DeveloperTips"
Changed:
<
<

Calling Windows API Functions

>
>

Calling O/S API Functions

 
Changed:
<
<
By using the PASS and CALL statements in APPX, the WIN32 functions can easily be accessed from APPX subroutines. This paper discusses some of the issues involved in invoking Windows API functions from within an APPX application. The TAPI functions act as a link between the computer and the phone system. In our example, we will demonstrate how to place a simple call to an alpha numeric pager using functions exported by the TAPI API.
>
>
By using the PASS and CALL statements in APPX, O/S libraries and functions can easily be accessed from APPX subroutines.
 
Changed:
<
<
Documentation for these functions can be found online at: http://search.microsoft.com/us/dev/default.asp or is available as part of the MSDN library.
>
>
This paper discusses some of the issues involved in invoking Windows API functions from within an APPX application, however the concepts are the same for Linux/Unix, etc.

The TAPI functions act as a link between the computer and the phone system. In our example, we will demonstrate how to place a simple call to an alpha numeric pager using functions exported by the TAPI API.

Documentation for these functions can be found online at: http://search.microsoft.com/us/dev/default.asp or is available as part of the MSDN library.

  Below is a sample of the documentation you can find at Microsoft's MSDN website:
Changed:
<
<
lineClose - The lineClose function closes the specified open line device.
>
>
lineClose - The lineClose function closes the specified open line device.
 

LONG WINAPI lineClose(
HLINEhLine
);

Changed:
<
<
Parameters
>
>
Parameters
 

hLine

Line: 23 to 27
 A handle to the open line device to be closed. After the line has been successfully closed, this handle is no longer valid.
Changed:
<
<
Return Values - Returns zero if the request succeeds or a negative error number if an error occurs. Possible return values are:
>
>
Return Values - Returns zero if the request succeeds or a negative error number if an error occurs. Possible return values are:
 
  • LINEERR_INVALLINEHANDLE
  • LINEERR_RESOURCEUNAVAIL
  • LINEERR_NOMEM
  • LINEERR_UNINITIALIZED
  • LINEERR_OPERATIONFAILED
  • LINEERR_OPERATIONUNAVAIL
Changed:
<
<
Remarks
>
>
Remarks
  If an application calls lineClose while it still has active calls on the opened line, the application's ownership of these calls is revoked. If the application was the sole owner of these calls, the calls are dropped as well. It is good programming practice for an application to dispose of the calls it owns on an opened line by explicitly relinquishing ownership and/or by dropping these calls prior to closing the line.
Line: 40 to 44
  The lineOpen function allocates resources to the invoking application, and applications can be prevented from opening a line if resources are unavailable. Therefore, an application that only occasionally uses a line device (such as for making outgoing calls) should close the line to free resources and allow other applications to open the line.
Changed:
<
<
Requirements
>
>
Requirements
 
  • Windows NT/2000: Requires Windows NT 4.0 SP3 or later.
  • Windows 95/98: Requires Windows 95 or later.
  • Version: Requires TAPI 1.3 or later.
Line: 60 to 64
 
DWORD 10 digit Binary Storage Numeric
HANDLE 10 digit Binary Storage Numeric
POINTER 10 digit Binary Storage Numeric
Changed:
<
<
CSTR

Size varies with

usage Alpha
>
>
CSTR Size varies with usage Alpha
 
LPCSTR 10 digit Binary Storage Numeric
LPDWORD 10 digit Binary Storage Numeric
Deleted:
<
<
 The prefix "LP" means a 'pointer to' or 'address of', so a LPCSTR is a 'pointer to a CSTR'. A CSTR is a null-terminated string, so an LPCSTR is a pointer to a null-terminated string. An LPDWORD would be a 'pointer to a DWORD'.

LPCSTR and LPSTR are a little tricky - if an LPCSTR is a function parameter, you should pass a (null-terminated) shared alpha field: if an LPCSTR appears within a structure, you will need to put the address of an alpha field in the structure (see below).

Line: 112 to 115
  Remarks
Changed:
<
<
See lineInitializeEx for further information on these options.
>
>
See lineInitializeEx for further information on these options.
 
Changed:
<
<
QuickInfo
>
>
QuickInfo
  Version: Requires TAPI 2.0 or later.
Windows CE: Unsupported.
Header: Declared in tapi.h.
Line: 148 to 151
 
  • The file must contain a field for each member of the Structure, even though some of the fields in the struct may not be used.
  • A struct may need to contain a null terminated field - this must be done prior to PASSing the record to the CALL statement.
  • If the length of the struct is to be passed as an additional argument, that length can be determined (easily) by accessing Print Technical Documentation, in Utilities.
Changed:
<
<

PASSing, Share?ing and CALLing

>
>

PASSing, Shareing and CALLing

  Most of the Windows functions require that parameters be PASSed, either to provide or return data. If a parameter is a pointer, you must PASS it shared. If a parameter is not a pointer, you pass it non-shared. Usually, Microsoft will require a pointer if a parameter is used to give data back to us. The Microsoft documentation should be referred to when deciding which fields to pass shared. Strings are always passed shared (because a string is represented by the address of the first character). Structures are PASSed as RECORD with the Shared? flag set to Y.
Line: 412 to 415
  To define a 'short' field, define a binary field with a range check of −32,768 to 32,767 for a signed binary or to 65,535 for unsigned.
Deleted:
<
<
-- JeanNeron - 2014-01-29
<--/commentPlugin-->
 \ No newline at end of file
Added:
>
>
-- JeanNeron - 2014-01-29
<--/commentPlugin-->
 \ No newline at end of file
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback