EuCOM : Attn Matt : String Return Value
Hi Matt,
I am trying to use one string encryption ocx using EuCOM.
TBrowse generates following method-
global constant
OneCryptA_clsid = "A90A1595-9949-4339-999E-D596977BD473",
OneCryptA_clsid_ix = add_clsid( OneCryptA_clsid) ,
OneCryptA_disp = add_iid( OneCryptA_clsid_ix, IDispatch),
OneCryptA_IQuickActivate_ix = add_iid( OneCryptA_clsid_ix, IQuickActivate ),
OneCryptA_IPersistStreamInit_ix = add_iid(
OneCryptA_clsid_ix, IPersistStreamInit ),
OneCryptA_IConnectionPointContainer_ix = add_iid(
OneCryptA_clsid_ix, IConnectionPointContainer )
--methods
-- disp methods for OneCryptA
global constant
OneCryptA_m_DecryptFile = 204,
-- Returns: VT_I4
-- Key VT_BSTR [IN]
-- InPath VT_BSTR [IN]
-- OutPath VT_BSTR [IN]
OneCryptA_m_DecryptString = 202,
-- Returns: VT_BSTR
-- Key VT_BSTR [IN]
-- InString VT_BSTR [IN]
OneCryptA_m_DrawTextBiDiModeFlagsReadingOnly = 213,
-- Returns: VT_I4
OneCryptA_m_EncryptFile = 203,
-- Returns: VT_I4
-- Key VT_BSTR [IN]
-- InPath VT_BSTR [IN]
-- OutPath VT_BSTR [IN]
global constant
OneCryptA_m_EncryptString = 201,
-- Returns: VT_BSTR
-- Key VT_BSTR [IN]
-- InString VT_BSTR [IN]
The method returns a string value.
parameters for the method are-
Parameters
Name Data Type Description
==== ==== ================
Key string Encryption Key / Password / Phrase
InString string Input string (plaintext)
Return Value
Data Type Description
==== ================
string Encrypted string
I am calling the method as follows:
OC6 = create_com_object( OneCryptA_clsid_ix )
if not OC6 then
void = message_box("Registering mssreg3.ocx...", "msg", MB_ICONINFORMATION)
void = open_dll("mssreg3.ocx")
void = define_c_proc( void, "DllRegisterServer", {})
c_proc( void, {})
OC6 = create_com_object( OneCryptA_clsid_ix )
end if
if not OC6 then
void = message_box("Create Error for mssreg3.ocx!", "msg", MB_ICONERROR)
closeWindow(Window1)
end if
pBstr = alloc_bstr(getText(EditText18)) -- string to be encrypted
OCString = peek_bstr(pBstr) -- works fine
pBstr = invoke( OC6, {OneCryptA_m_EncryptString},
{alloc_bstr(OW6AppId), alloc_bstr(OCString)},
{VT_BSTR, VT_BSTR}, DISPATCH_METHOD )
void = message_box("Input String = " & OCString & "\n" &
"pBstr = " & sprintf("%d", pBstr),
"msg", MB_ICONINFORMATION)
setText(EditText19, peek_bstr(pBstr))
Whatever be the value of EditText18, pBstr always comes back with fixed value
2147614729.
And following error is generated at the syntax line of setText(EditText19,
peek_bstr(pBstr))-
---------------------------------------------------------
D:\EUPHORIA\EuCOM\unicode.ew:176 in function peek_bstr()
A machine-level exception occurred during execution of this statement
bstr = 2147614729
len = <no value>
... called from D:\EUPHORIA\EuCOM\OneWay60.exw:231 in procedure proc_onecrypt()
---------------------------------------------------------
I tried to get the return value in a sequence but got type mismatch error.
How to get a String as return value for this method?
Regards,
Rad.
|
Not Categorized, Please Help
|
|