-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Ganesh Rao
Message 1 in Discussion

Hi,
I am facing some problems when passing array from javascript to COM components:
The code is working properly for VBSCript.
When I checked the datatype for this array, I am getting the different values: 
for VBScript it is showing as VT_ARRAY and for Javascript as VT_DISPATCH.  
Because of this I am not able to get the array members in VC++ component. 
PLease suggest me how to resolve this? 
Javascript code:
----------------
function main()
{
var procName;
var prmIn = new Array(1); prmIn[0] = "g1";
prmIn[1] = "g2"; 
var boolValue;
boolValue = myAPI(prmIn);
if(boolValue == 0)
{
logMessage(1, "ERR: executeSPOutParams failed");
}
else
{
logMessage(1, "executeSPOutParams PASS");
}
} COM code:
----------
HRESULT test::myAPI(VARIANT* varInParams)
{..................
VARIANT *varArrParams;  
 try
 {
  long lParamCount = 0;
  HRESULT hr;
  if(varInParams->vt == (VT_VARIANT|VT_BYREF|VT_ARRAY))
  {
   //Input SP parameter    SAFEARRAY** ppsa = (SAFEARRAY**)varInParams->pparray;
   hr = SafeArrayGetUBound(*ppsa, 1, &lParamCount);   
   SafeArrayAccessData(*ppsa, (void **)&varArrParams);    for(long lPrmCount = 
0 ; lPrmCount <= lParamCount; lPrmCount++)
   {
    //data here varArrParams[lPrmCount]);
   }
   SafeArrayUnaccessData(*ppsa);
  }
  else if(varInParams->vt != VT_EMPTY)
  { 
..........................
  }
.....................
} For Vb script if part is executed and for and for javascript it goes to else 
part. Please suggest me if it is VT_DISPATCH how to get the array values? 
Thanks & Regards
Ganesh Rao


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to