Converting MAPI function from VO to X# - PCALL typed function pointer
Posted: Wed Sep 28, 2022 8:43 pm
Converting from VO app to X# and have some MAPI email functions that I got from Phil McGuinnes around 2006. I'm not sure whether to rewrite this section using the MS.Outlook.Interop or just fix up the MAPI as it is only used in a couple of methods and Interop for the rest.
Anyway - here's my question, maybe someone has already solved it?
X# error XS9035 The first argument to PCALL must be a "typed function pointer".
Does that mean typing sMAPI.pLogon, or is there a new parameter required?
If typing pLogon, it is declared as a PTR elsewhere - so what is the syntax to type it in PCALL please?
PCALL function is below, and the MAPILogon function below that.
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
FUNCTION MAPILogon( ulUIParam AS DWORD , ;
lpszName AS PSZ , ;
lpszPassword AS PSZ , ;
flFlags AS DWORD , ;
ulReserved AS DWORD , ;
lphSession REF DWORD ) AS DWORD PASCAL
LOCAL nResult AS DWORD
IF _MAPIInit()
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
ENDIF
RETURN nResult
While I'm here, Argument 6 may not be passed with the '@' prefix?
IF _MAPIInit()
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
ENDIF
I have attached all the MAPI function Phil provided as an attachment.
Thank you!
Jonathan
Anyway - here's my question, maybe someone has already solved it?
X# error XS9035 The first argument to PCALL must be a "typed function pointer".
Does that mean typing sMAPI.pLogon, or is there a new parameter required?
If typing pLogon, it is declared as a PTR elsewhere - so what is the syntax to type it in PCALL please?
PCALL function is below, and the MAPILogon function below that.
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
FUNCTION MAPILogon( ulUIParam AS DWORD , ;
lpszName AS PSZ , ;
lpszPassword AS PSZ , ;
flFlags AS DWORD , ;
ulReserved AS DWORD , ;
lphSession REF DWORD ) AS DWORD PASCAL
LOCAL nResult AS DWORD
IF _MAPIInit()
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
ENDIF
RETURN nResult
While I'm here, Argument 6 may not be passed with the '@' prefix?
IF _MAPIInit()
nResult := DWORD( _CAST , PCALL( sMAPI.pLogon , ;
ulUIParam , ;
PSZ( _CAST , lpszName ) , ;
PSZ( _CAST , lpszPassword ) , ;
flFlags , ;
0 , ;
@lphSession ) )
ENDIF
I have attached all the MAPI function Phil provided as an attachment.
Thank you!
Jonathan