// 96-03-18 Michael Kocum
//
// Translated German notes
//
// Added Exchange flags
//
// Changed ulRecipClass in MAPIAddress
// to MAPI_TO to be compatible with FiveWin
//
// Added a counter for loading MAPI.LIB
// because MSMAIL 3.2 clears all pending
// sessions when MAPI.DLL is loaded twice
// and as a result, nothing is working as exspected.
// ( Exchange and WFW have no problems )
// As a result of this
// every LOGON needs a LOGOFF or
// the DLL will not released.
//
// Changed MAPISendMail, MAPIResolveName,
// MAPIAddress to let them work without needing
// a LOGON first (MAPI does the logon in the fly).
//
// The flag MAPI_LOGON_UI is set when no valid
// MAPI session is established to let MAPI popup
// an logon dialog if neccessary. Without this
// MAPI returns an error if there is no default
// in MSMAIL.INI
//
// Changed the first paramter of MAPISendDocuments
// to be Window Handle instead of Mapi Session Handle as
// stated in the MAPI documentation
//
// Added define for
//
// Changed MAPILogoff to return a value in any case
//
// Changed MAPILogon, MAPISendMail and MAPIDelete to
// return -1 when the Log could not be loaded (old version)
// returned a ULONG -1 which results in 65535
//
// Fixed MAPIDelete to return MAPI_E_INVALID_SESSION when no
// session is established
//
// defines a little bit other processing of MAPI_TO as FiveWin
// #define KOCUM
// define a error number above the one MSMAIL uses
#define ERR_CANT_LOAD_MAPI 60000
#ifdef __FLAT__
#undef MAPILOGON
#define MAPILOGON _MAPILOGON
#undef MAPILOGOFF
#define MAPILOGOFF _MAPILOGOFF
#endif
#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>
#include <Mapi.h>
#ifdef __FLAT__
#undef MAPILOGON
#define MAPILOGON MAPILOGON
#undef MAPILOGOFF
#define MAPILOGOFF MAPILOGOFF
#undef PASCAL
#define PASCAL
#endif
#ifdef __HARBOUR__
#ifndef __C3__
#include <hbapi.h>
#include <hbstack.h>
#define _VARRAYLEN(x) hb_arrayLen(x)
#define S_ARRAY ARRAY
#endif
#endif
//
// Exchange Flags
//
#define MAPI_PASSWORD_UI 0x00020000 /* prompt for password only */
#define MAPI_ALLOW_OTHERS 0x00000008 /* Make this a shared session */
#define MAPI_EXPLICIT_PROFILE 0x00000010 /* Don't use default profile */
#define MAPI_EXTENDED 0x00000020 /* Extended MAPI Logon */
#define MAPI_USE_DEFAULT 0x00000040 /* Use default profile in logon */
typedef unsigned short USHORT;
typedef BYTE * BYTEP;
typedef double XDOUBLE;
// #ifndef __FLAT__
#include <item.api>
// #endif
#ifndef __FLAT__
#define MAPI_DLL "mapi.dll"
#else
#define MAPI_DLL "mapi32.dll"
#endif
static LHANDLE lhMailHandle = 0L;
static ULONG nMapiAccessCount = 0L;
static HINSTANCE hMapiLib = 0L;
//----------------------------------------------------------------------------//
BOOL static LoadMapiLib( void )
{
// check if Mapi.DLL is loaded and don't load it twice
if( hMapiLib >= ( HINSTANCE) 32 )
{
nMapiAccessCount ++ ; // increment counter
return TRUE ;
}
else
{
if((hMapiLib = LoadLibrary( MAPI_DLL )) >= (HINSTANCE) 32)
{
nMapiAccessCount ++ ; // increment counter
return TRUE ;
}
}
return FALSE ;
}
//----------------------------------------------------------------------------//
void static FreeMapiLib( void )
{
nMapiAccessCount -- ; // decrement counter
// check if there are pending calls
if( nMapiAccessCount )
{
// check if we have a closed all sessions
if( lhMailHandle )
{
FreeLibrary( hMapiLib );
}
}
}
//----------------------------------------------------------------------------//
ULONG static FreeBuffer( LPVOID pv )
{
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPIFREEBUFFER lpfnMAPIFreeBuffer;
if( LoadMapiLib() )
{
lpfnMAPIFreeBuffer = ( LPMAPIFREEBUFFER ) GetProcAddress(hMapiLib,"MAPIFreeBuffer") ;
rc = (*lpfnMAPIFreeBuffer)( pv ) ;
FreeMapiLib();
}
return( rc ) ;
}
//----------------------------------------------------------------------------//
HB_FUNC( MAPILOGON )
{
LPSTR szUserName = ( LPSTR ) IF( PCOUNT() >= 1 && ISCHAR( 1 ), hb_parc( 1 ), NULL );
LPSTR szPassword = ( LPSTR ) IF( PCOUNT() >= 2 && ISCHAR( 2 ), hb_parc( 2 ), NULL );
FLAGS nFlags = IF( PCOUNT() >= 3 && ISNUM( 3 ) , hb_parnl( 3 ),
MAPI_LOGON_UI | MAPI_NEW_SESSION | MAPI_USE_DEFAULT );
ULONG rc;
LPMAPILOGON lpfnMAPILogon;
if( LoadMapiLib() )
{
lpfnMAPILogon = ( LPMAPILOGON ) GetProcAddress( hMapiLib, "MAPILogon" );
rc = ( *lpfnMAPILogon )( ( ULONG ) GetActiveWindow(), szUserName, szPassword,
nFlags, 0, ( LPLHANDLE ) &lhMailHandle );
FreeMapiLib();
hb_retnl( rc );
}
else
{
hb_retnl( -1 );
}
}
//----------------------------------------------------------------------------//
HB_FUNC( MAPILOGOFF )
{
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPILOGOFF lpfnMAPILogoff;
// Session had to exist
if( lhMailHandle )
{
if( LoadMapiLib() )
{
lpfnMAPILogoff = ( LPMAPILOGOFF ) GetProcAddress(hMapiLib,"MAPILogoff") ;
rc = (*lpfnMAPILogoff)( lhMailHandle, ( ULONG ) GetActiveWindow(),0, 0 ) ;
lhMailHandle = 0;
FreeMapiLib();
}
}
hb_retl( rc ) ;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( MAPISENDMAIL )
#else
HB_FUNC( MAPISENDMA )
#endif
{
MapiMessage msg;
MapiRecipDesc origin;
MapiRecipDesc target[ 10 ];
MapiFileDesc FileDesc[ 10 ];
WORD w, wLen;
ULONG rc;
LPMAPISENDMAIL lpfnMAPISendMail;
FLAGS nFlags;
memset( ( char * ) &msg, 0, sizeof( msg ) );
memset( ( char * ) &origin, 0, sizeof( origin ) );
memset( ( char * ) target, 0, sizeof( target ) );
memset( ( char * ) FileDesc,0, sizeof( FileDesc ) );
msg.ulReserved = 0;
msg.lpszSubject = ( LPSTR ) IF( ISCHAR( 1 ), hb_parc( 1 ), NULL );
msg.lpszNoteText = ( LPSTR ) IF( ISCHAR( 2 ), hb_parc( 2 ), NULL );
msg.lpszMessageType = ( LPSTR ) IF( ISCHAR( 3 ), hb_parc( 3 ), NULL );
msg.lpszDateReceived = ( LPSTR ) IF( ISCHAR( 4 ), hb_parc( 4 ), NULL );
// msg.lpszConversationID = IF( ISCHAR( 5 ), hb_parc( 5 ), NULL );
msg.flFlags = IF( ( ISLOGICAL( 6 ) && hb_parl( 6 ) ),
MAPI_RECEIPT_REQUESTED, 0 );
if( PCOUNT() >= 8 && ISARRAY( 8 ) &&
_VARRAYLEN( hb_param( 8, S_ARRAY ) ) )
{
origin.lpszName = ( LPSTR ) hb_parvc( 8, 1 );
origin.lpszAddress = ( LPSTR ) hb_parvc( 8, 2 );
msg.lpOriginator = &origin;
}
if( PCOUNT() >= 9 && ISARRAY( 9 ) &&
( wLen = _VARRAYLEN( hb_param( 9, S_ARRAY ) ) ) )
{
for( w = 0; w < wLen; w++ )
{
#ifndef __HARBOUR__
_cAt( hb_param( 9, S_ARRAY ), w + 1, -1, _eval );
#else
hb_arrayGet( hb_param( 9, S_ARRAY ), w + 1, hb_stackReturnItem() );
#endif
target[ w ].lpszName = ( LPSTR ) hb_parvc( -1, 1 );
target[ w ].lpszAddress = ( LPSTR ) hb_parvc( -1, 2 );
#ifdef KOCUM
target[ w ].ulRecipClass = hb_parvnl( -1, 3 ) ;
#else
target[ w ].ulRecipClass = IF( w == 0, MAPI_TO, MAPI_CC ); // hb_parnl( -1, 3 ) ;
#endif
}
msg.nRecipCount = wLen;
msg.lpRecips = target;
}
if( PCOUNT() >= 10 && ISARRAY( 10 ) &&
( wLen = _VARRAYLEN( hb_param( 10, S_ARRAY ) ) ) )
{
for( w = 0; w < wLen; w++ )
{
#ifndef __HARBOUR__
_cAt( hb_param( 10, S_ARRAY ), w + 1, -1, _eval );
#else
hb_arrayGet( hb_param( 10, S_ARRAY ), w + 1, hb_stackReturnItem() );
#endif
FileDesc[ w ].ulReserved = 0 ;
FileDesc[ w ].lpszPathName = ( LPSTR ) hb_parvc( -1, 1 );
FileDesc[ w ].lpszFileName = ( LPSTR ) hb_parvc( -1, 2 );
FileDesc[ w ].nPosition = -1 ;
}
msg.nFileCount = wLen;
msg.lpFiles = FileDesc;
}
if( LoadMapiLib() )
{
lpfnMAPISendMail = ( LPMAPISENDMAIL ) GetProcAddress( hMapiLib, "MAPISendMail");
nFlags = IF( ( ISLOGICAL( 7 ) && hb_parl( 7 ) ), MAPI_DIALOG, 0 ) ;
// Set flag when no MAPI session
if( ! lhMailHandle )
{
nFlags |= MAPI_LOGON_UI ;
}
rc = (*lpfnMAPISendMail)( lhMailHandle, ( unsigned long ) GetActiveWindow(), &msg,
nFlags,0) ;
FreeMapiLib();
hb_retnl( rc ) ;
}
else
{
hb_retnl( -1 );
}
}
//----------------------------------------------------------------------------//
//
// Para 1: Name
//
#ifdef __HARBOUR__
HB_FUNC( MAPIRESOLVENAME )
#else
HB_FUNC( MAPIRESOLV )
#endif
{
LPSTR szName = ( LPSTR ) IF( PCOUNT() == 1 && ISCHAR(1), hb_parc( 1 ), NULL );
lpMapiRecipDesc lppNewRecips;
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPIRESOLVENAME lpfnMAPIResolveName;
FLAGS nFlags = MAPI_DIALOG ;
if( LoadMapiLib() )
{
lpfnMAPIResolveName = ( LPMAPIRESOLVENAME ) GetProcAddress(hMapiLib,"MAPIResolveName") ;
if( ! lhMailHandle )
{
nFlags |= MAPI_LOGON_UI ;
}
rc = (*lpfnMAPIResolveName)( lhMailHandle, ( unsigned long ) GetActiveWindow(), szName, nFlags ,0, &lppNewRecips ) ;
FreeMapiLib();
}
if( rc == SUCCESS_SUCCESS)
{
hb_retc(lppNewRecips[0].lpszAddress);
FreeBuffer(lppNewRecips);
}
else
{
hb_retc("");
}
}
//----------------------------------------------------------------------------//
// Para 1: Caption
// Para 2: Label
// Para 3: Count of EditField
// Para 4: Array for defaults addresses
//
#ifdef __HARBOUR__
HB_FUNC( MAPIADDRESS )
#else
HB_FUNC( MAPIADDRES )
#endif
{
MapiRecipDesc lpDefRecip[ 10 ];
lpMapiRecipDesc lppNewRecips;
WORD w ;
WORD wLen; // Null vorbelegen
ULONG i ;
ULONG nDefCount = 0; // Null vorbelegen
ULONG nNewCount = 0;
LPSTR szCaption = ( LPSTR ) IF( PCOUNT() >= 1 && ISCHAR(1), hb_parc( 1 ), NULL );
LPSTR szLabels = ( LPSTR ) IF( PCOUNT() >= 2 && ISCHAR(1), hb_parc( 2 ), NULL ) ;
ULONG nEditFields = IF( PCOUNT() >= 3 && ISNUM(3) , hb_parnl( 3 ), 1 ) ;
ITEM nTemp,aTemp,cTemp,aRet ;
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPIADDRESS lpfnMAPIAddress;
FLAGS nFlags = 0 ;
memset( ( char * ) lpDefRecip, 0, sizeof( lpDefRecip ) );
// Set predefined values
if( ISARRAY( 4 ) && _VARRAYLEN( hb_param( 4, S_ARRAY ) ) )
{
wLen = _VARRAYLEN( hb_param( 4, S_ARRAY ) ) ;
for( w = 0; w < wLen; w++ )
{
#ifndef __HARBOUR__
_cAt( hb_param( 4, S_ARRAY ), w + 1, -1, _eval );
#else
hb_arrayGet( hb_param( 4, S_ARRAY ), w + 1, hb_stackReturnItem() );
#endif
lpDefRecip[ w ].lpszName = ( LPSTR ) hb_parvc( -1, 1 );
lpDefRecip[ w ].lpszAddress = ( LPSTR ) hb_parvc( -1, 2 );
#ifdef KOCUM
lpDefRecip[ w ].ulRecipClass = hb_parvnl( -1, 3 ) ;
#else
lpDefRecip[ w ].ulRecipClass = MAPI_TO ;
#endif
}
if( wLen > 0 )
{
nDefCount = wLen ;
}
}
if( LoadMapiLib() )
{
lpfnMAPIAddress = ( LPMAPIADDRESS ) GetProcAddress(hMapiLib,"MAPIAddress") ;
if( ! lhMailHandle )
{
nFlags |= MAPI_LOGON_UI ;
}
rc = (*lpfnMAPIAddress)( lhMailHandle, ( unsigned long ) GetActiveWindow(), szCaption, nEditFields,
szLabels, nDefCount, lpDefRecip, nFlags, 0, &nNewCount, &lppNewRecips) ;
FreeMapiLib();
}
if( rc == SUCCESS_SUCCESS)
{
aRet = _itemArrayNew( nNewCount ); // Create new array of that len
for ( i = 1; i <= nNewCount; i++ ) // Iterate through elements
{
aTemp = _itemArrayNew( 3 ); // Create new array of that len
cTemp = _itemPutC( NULL,lppNewRecips[ i - 1].lpszName);
_itemArrayPut( aTemp, 1, cTemp );
_itemRelease( cTemp );
// check address
if( lppNewRecips[ i - 1].lpszAddress )
{
cTemp = _itemPutC( NULL,lppNewRecips[ i - 1].lpszAddress);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aTemp, 2, cTemp );
_itemRelease( cTemp );
nTemp = _itemPutNL( NULL,lppNewRecips[ i - 1].ulRecipClass);
_itemArrayPut( aTemp, 3, nTemp );
_itemRelease( nTemp );
_itemArrayPut( aRet, i, aTemp );
_itemRelease( aTemp );
}
_itemReturn ( aRet );
_itemRelease( aRet ); // release "aRet"
FreeBuffer(lppNewRecips);
}
else
{
aRet = _itemArrayNew( 0 ); // Create new array of that len
_itemReturn ( aRet );
_itemRelease( aRet ); // release "aRet"
}
}
//----------------------------------------------------------------------------//
//
// Para 1: Typ ("IPM" does not work )
// Para 2: Flags
// Para 3: Message ID
//
#ifdef __HARBOUR__
HB_FUNC( MAPIFINDNEXT )
#else
HB_FUNC( MAPIFINDNE )
#endif
{
LPSTR szTyp = ( LPSTR ) IF( ISCHAR(1), hb_parc( 1 ) , NULL );
FLAGS flFlags = IF( ISNUM(2) , hb_parnl( 2 ), 0 );
LPSTR szSeedMessageID = ( LPSTR ) IF( ISCHAR(3), hb_parc( 3 ) , NULL );
char szMessageID [ 254 ] ;
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPIFINDNEXT lpfnMAPIFindNext;
// Logon has to be done, because further calls will need the same session
if( lhMailHandle )
{
strcpy( szMessageID, "" );
if( LoadMapiLib() )
{
lpfnMAPIFindNext = ( LPMAPIFINDNEXT ) GetProcAddress(hMapiLib,"MAPIFindNext") ;
rc = (*lpfnMAPIFindNext)( lhMailHandle, ( unsigned long ) GetActiveWindow(), szTyp,
szSeedMessageID, flFlags, 0, szMessageID ) ;
FreeMapiLib();
}
if( rc == SUCCESS_SUCCESS )
{
hb_retc(szMessageID);
}
else
{
hb_retc("");
}
}
}
//----------------------------------------------------------------------------//
//
// Para 1: Message ID
// Para 2: Flags
//
#ifdef __HARBOUR__
HB_FUNC( MAPIREADMAIL )
#else
HB_FUNC( MAPIREADMA )
#endif
{
FLAGS flFlags = IF( ISNUM(2) , hb_parnl( 2 ), MAPI_ENVELOPE_ONLY | MAPI_SUPPRESS_ATTACH | MAPI_PEEK);
LPSTR szMessageID = ( LPSTR ) IF( ISCHAR(1), hb_parc( 1 ) , NULL );
lpMapiMessage FAR *lppMapiMess;
lpMapiMessage lpMapiMess;
ITEM nTemp,cTemp,aRet,aTemp,aAdr ;
ULONG i ;
ULONG rc = ERR_CANT_LOAD_MAPI;
LPMAPIREADMAIL lpfnMAPIReadMail;
// Logon has to be done, because the ID needs to be from the same session
if( lhMailHandle )
{
lppMapiMess = (lpMapiMessage FAR *) &lpMapiMess;
if( LoadMapiLib() )
{
lpfnMAPIReadMail = ( LPMAPIREADMAIL ) GetProcAddress(hMapiLib,"MAPIReadMail") ;
rc = (*lpfnMAPIReadMail)( lhMailHandle, ( unsigned long ) GetActiveWindow(), szMessageID,
flFlags,0,lppMapiMess) ;
FreeMapiLib();
}
if( rc == SUCCESS_SUCCESS )
{
// Subject 1
// NoteText 2
// Type 3
// Date 4
// Flags 5
// Recipient (To) 6
// Originator (From) 7
aRet = _itemArrayNew( 7 ) ;
if( lpMapiMess->lpszSubject )
{
cTemp = _itemPutC(NULL,lpMapiMess->lpszSubject);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aRet, 1, cTemp );
_itemRelease( cTemp );
//
// Testen ob NoteText gekommen ist
//
if( lpMapiMess->lpszNoteText )
{
cTemp = _itemPutC(NULL,lpMapiMess->lpszNoteText);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aRet, 2, cTemp );
_itemRelease( cTemp );
cTemp = _itemPutC(NULL,lpMapiMess->lpszMessageType);
_itemArrayPut( aRet, 3, cTemp );
_itemRelease( cTemp );
if( lpMapiMess->lpszDateReceived )
{
cTemp = _itemPutC(NULL,lpMapiMess->lpszDateReceived);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aRet, 4, cTemp );
_itemRelease( cTemp );
nTemp = _itemPutNL(NULL,lpMapiMess->flFlags);
_itemArrayPut( aRet, 5, nTemp );
_itemRelease( nTemp );
//
// Add recipients
//
aAdr = _itemArrayNew( lpMapiMess->nRecipCount ); // Create new array of that len
for ( i = 1; i <= lpMapiMess->nRecipCount; i++ ) // Iterate through elements
{
aTemp = _itemArrayNew( 3 ); // Create new array of that len
if( lpMapiMess->lpRecips[ i - 1].lpszName )
{
cTemp = _itemPutC( NULL,lpMapiMess->lpRecips[ i - 1].lpszName);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aTemp, 1, cTemp );
_itemRelease( cTemp );
// Check if adress is ok
// ( local groups have no adress )
if( lpMapiMess->lpRecips[ i - 1].lpszAddress )
{
cTemp = _itemPutC( NULL,lpMapiMess->lpRecips[ i - 1].lpszAddress);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aTemp, 2, cTemp );
_itemRelease( cTemp );
nTemp = _itemPutNL( NULL,lpMapiMess->lpRecips[ i - 1].ulRecipClass);
_itemArrayPut( aTemp, 3, nTemp );
_itemRelease( nTemp );
_itemArrayPut( aAdr, i, aTemp );
_itemRelease( aTemp );
}
_itemArrayPut( aRet, 6, aAdr );
_itemRelease( aAdr );
//
// Add FROM
//
aAdr = _itemArrayNew( 1 ); // Create new array of that len
aTemp = _itemArrayNew( 3 ); // Create new array of that len
if( lpMapiMess->lpOriginator->lpszName )
{
cTemp = _itemPutC( NULL,lpMapiMess->lpOriginator->lpszName);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aTemp, 1, cTemp );
_itemRelease( cTemp );
// Check adress
if( lpMapiMess->lpOriginator->lpszAddress )
{
cTemp = _itemPutC( NULL,lpMapiMess->lpOriginator->lpszAddress);
}
else
{
cTemp = _itemPutC( NULL,"");
}
_itemArrayPut( aTemp, 2, cTemp );
_itemRelease( cTemp );
nTemp = _itemPutNL( NULL,lpMapiMess->lpOriginator->ulRecipClass);
_itemArrayPut( aTemp, 3, nTemp );
_itemRelease( nTemp );
_itemArrayPut( aAdr, 1, aTemp );
_itemRelease( aTemp );
_itemArrayPut( aRet, 7, aAdr );
_itemRelease( aAdr );
_itemReturn ( aRet );
_itemRelease( aRet ); // release "aRet"
rc = FreeBuffer(lpMapiMess);
if( rc == SUCCESS_SUCCESS )
{
}
else
{
MessageBox( 0, "MAPI memory not released!", "Error", 0 );
}
}
else
{
aRet = _itemArrayNew( 0 ); // Create new array of that len
_itemReturn ( aRet );
_itemRelease( aRet ); // release "aRet"
}
}
else
{
// Better return NIL, so that we know in the case of an error
// aRet = _itemArrayNew( 0 ); // Create new array of that len
// _itemReturn ( aRet );
// _itemRelease( aRet ); // release "aRet"
}
}
//----------------------------------------------------------------------------//
//
// Para 1: ID der Message
//
#ifdef __HARBOUR__
HB_FUNC( MAPIDELETEMAIL )
#else
HB_FUNC( MAPIDELETE )
#endif
{
LPSTR szMessageID = ( LPSTR ) IF( ISCHAR(1), hb_parc( 1 ) , NULL );
ULONG rc;
LPMAPIDELETEMAIL lpfnMAPIDeleteMail;
// Logon has to be done, because the ID needs to be from the same session
if( lhMailHandle )
{
if( LoadMapiLib() )
{
lpfnMAPIDeleteMail = ( LPMAPIDELETEMAIL ) GetProcAddress(hMapiLib,"MAPIDeleteMail") ;
rc = (*lpfnMAPIDeleteMail)( lhMailHandle, ( unsigned long ) GetActiveWindow(),
szMessageID,0,0) ;
FreeMapiLib();
hb_retnl( rc ) ;
}
else
{
hb_retnl( -1 );
}
}
else
{
hb_retnl( MAPI_E_INVALID_SESSION ) ;
}
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( MAPISENDDOCUMENTS ) // CUMENTS( nUiParam, cDelimiters, cFilePaths,
// cFileNames, nReserved ) --> nResult
#else
HB_FUNC( MAPISENDDO ) // CUMENTS( nUiParam, cDelimiters, cFilePaths,
// cFileNames, nReserved ) --> nResult
#endif
{
LPMAPISENDDOCUMENTS lpfnMAPISendDocuments;
if( LoadMapiLib() )
{
lpfnMAPISendDocuments = ( LPMAPISENDDOCUMENTS ) GetProcAddress( hMapiLib,
"MAPISendDocuments" );
hb_retnl( ( * lpfnMAPISendDocuments )( ( unsigned long ) GetActiveWindow(), ",", 0,
( char * ) hb_parc( 1 ), 0 ) );
FreeMapiLib( );
}
else
{
hb_retnl( -1 );
}
}
//----------------------------------------------------------------------------//