|
Memory Allocation
Memory for all data structures used by the API must be allocated by the
application. The application passes a pointer to the API function that returns the
information, and the function fills the data structure with the requested
information. If the operation is asynchronous, then the information is not available
until the asynchronous reply message indicates success.
All data structures used to pass information between the application and the
Telephony API are flattened. This means that data structures do not contain pointers to substructures
that contain variably sized components of information. Instead, data structures
that are used to pass variable amounts of information back to the application
have the following meta structure:
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
<fixed size fields>
DWORD dw<VarSizeField1>Size;
DWORD dw<VarSizeField1>Offset;
<fixed size fields>
DWORD dw<VarSizeField2>Size;
DWORD dw<VarSizeField2>Offset;
<common extensions>
<var sized field1>
<var sized field2>
The dwTotalSize field is the size in bytes allocated to this data structure. It marks the end
of the data structure and is set by the application before it invokes the
function that uses this data structure. The function will not read or write beyond
this size. An application must set the dwTotalSize field to indicate the total number of bytes allocated for TAPI to return the
contents of the structure.
The dwNeededSize field is filled in by TAPI. It indicates how many bytes are needed to return
all the information requested. The existence of variably sized fields often
makes it impossible for the application to estimate the data structure size it
needs to allocate. This field simply returns the number of bytes actually needed
for the information. This number could be smaller than, equal to, or larger than dwTotalSize, and it includes space for the dwTotalSize field itself. If larger, the returned structure is only partially filled. If
the fields the application is interested in are available in the partial
structure, nothing else must be done. Otherwise, the application should allocate a
structure at least the size of dwNeededSize and invoke the function again. Usually, enough space will be available this
time to return all the information, although it is possible the size could have
increased again.
The dwUsedSize field is filled in by TAPI if it returns information to the application to
indicate the actual size in bytes of the portion of the data structure that
contains useful information. If, for example, a structure that was allocated was too
small and the truncated field is a variably sized field, dwNeededSize will be larger than dwTotalSize, and the truncated field will be left empty. The dwUsedSize field could therefore be smaller than dwTotalSize. Partial field values are not returned.
Following this header is the fixed part of the data structure. It contains
regular fields and size/offset pairs that describe the actual variably sized
fields. The offset field contains the offset in bytes of the variably sized field
from the beginning of the record. The size field contains the size in bytes of
the variably sized field. If a variably sized field is empty, then the size field
is zero and the offset is set to zero. Variably sized fields that would be
truncated if the total structure size is insufficient are left empty. That is,
their size field is set to zero and the offset is set to zero. The variably sized
fields follow the fixed fields.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|