FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ActiveX paramaters as Byte
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
ActiveX paramaters as Byte
Posted: Fri Sep 18, 2009 07:51 AM
I'm using an ActivexControl, and I need to call one method, but the parameter must be Array Byte, anyway to do it?

For example this VB code runs ok
Code (fw): Select all Collapse
Dim blob() As Byte
 ' Read binary data from file.
 Open CommonDialog1.FileName For Binary As #1
 ReDim blob(LOF(1))
 Get #1, , blob()
 Close #1
 Templ.Deserialize blob

Thanks in advance.
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ActiveX paramaters as Byte
Posted: Fri Sep 18, 2009 01:06 PM

Biel,

Try using a Harbour array of numbers, i.e.:
{ 1, 2, 3, ... }

It gets converted into a SAFEARRAY which it is the way it is expected from the Activex side

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Re: ActiveX paramaters as Byte
Posted: Fri Sep 18, 2009 03:38 PM
Antonio thanks for answering,
Tested with array, but do not accept this kind of parameter, the program crash.

Code (fw): Select all Collapse
xVar1:=oTmp:Serialize()
oTmp:Deserialize( xVar1) //Runs Ok

Code (fw): Select all Collapse
xVar1:=oTmp:Serialize()
?ValType(xVar1) //  C
?Len(xVar1) //318
xVar2:=''
FOR i:=1 TO Len(xVar1)
   xVar2+=SubStr(xVar1,i,1)
NEXT
?Len(xVar2),Len(xVar1) //318 318
?ValType(xVar2), Valtype(xVar1) // C C
?xVar2==xVAr1  // .T.
oTmp:Deserialize( xVar1) //Runs Ok
oTmp:Deserialize( xVar2) //Crash
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ActiveX paramaters as Byte
Posted: Fri Sep 18, 2009 04:34 PM
Biel,

This is obvious, but have you tried it in this order ?
Code (fw): Select all Collapse
oTmp:Deserialize( xVar2) //Crash
oTmp:Deserialize( xVar1) //Runs Ok
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Re: ActiveX paramaters as Byte
Posted: Mon Sep 21, 2009 10:48 AM
Yes I have tryed also, and not run.

As no one else has answered, please Antonio swtich to the spanish post , more easy for me.
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=16732
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ActiveX paramaters as Byte
Posted: Mon Sep 21, 2009 01:22 PM

Biel,

ok :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion