Activex difference between FWH/XHB

Activex difference between FWH/XHB

Postby Adolfo » Wed Jun 07, 2006 1:08 am

Antonio

This piece of code works ok in Xhb.com

Comando:=Chr(2) + Chr(1)
Ef:AddDataField(Comando)

Extension:=VtArrayWrapper(VT_UI1,(CHR(0) + CHR(0) + CHR(0) + CHR(0)))
Ef:AddDataField( Extension )
Ef:SendCommand()

It sends 13 bits to com1, like the OCX is intended to do..
--> Length 13: 02 D5 1B 02 01 1C 00 00 03 30 31 31 34

But....

Comando:=Chr(2) + Chr(1)
Ef:DO("AddDataField",COMANDO)

Extension:=VtArrayWrapper(VT_UI1,(CHR(0) + CHR(0) + CHR(0) + CHR(0)))
Ef:DO("AddDataField", Extension)
Ef:Do("SendCommand")

... sends only 11
--> Length 11: 02 D5 1B 02 01 1C 03 30 31 31 34


My definition of the Activex is like this...

Ef:=TActiveX():New( , "EpsonFPHostControlX.EpsonFPHostControl")
Ef:nWidth = 0
Ef:nHeight = 0
Ef:Do("OpenPort")

Quite simple, in Xhb Works Ok but I can't make it work in FWH only...

Any help will be appreciated.
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Wed Jun 07, 2006 11:40 am

Adolfo,

Where are these bytes defined ?

> 02 D5 1B 02 01 1C 00 00 03 30 31 31 34

It looks as the two in between zeros are the missing ones.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Adolfo » Wed Jun 07, 2006 12:47 pm

Antonio.

This is just an example, because in the real string, the last 3 groups of bytes are the validation bytes, which change with each string sent to the port.

--> Length 13: 02 D5 1B 02 01 1C -> 00 00 <- 03 30 31 31 34

--> Length 11: 02 D5 1B 02 01 1C -> <- 03 30 31 31 34

Is the problem a diferent way in which xhb and FWH send the parameters to the Method inside the activex class ?

All the other properties, errors messages are recovered without problems, and the only one which is still bothering me is this one.

Next step is to control the Events, but I've seen some examples which I'm gonna look at.

Thanks in advance
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Wed Jun 07, 2006 1:20 pm

Adolfo,

Please try this code:

MsgInfo( Len( WideToAnsi( AnsiToWide( <cData> ) ) ) == Len( <cData> ) )

where <cData> is the bytes string you send.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Adolfo » Wed Jun 07, 2006 1:35 pm

Antonio Linares wrote:Adolfo,

Please try this code:

MsgInfo( Len( WideToAnsi( AnsiToWide( <cData> ) ) ) == Len( <cData> ) )

where <cData> is the bytes string you send.


With this code

Comando:=chr(2) + Chr(1)
lRes:=Ef:DO("AddDataField",Comando)

MsgInfo( Len( WideToAnsi( AnsiToWide( Comando ) ) ) == Len( Comando ) )

........ The result is .T.

Extension:=VtArrayWrapper(VT_UI1,(CHR(0) + CHR(0) + CHR(0) + CHR(0)))
Ef:DO("AddDataField", Extension)
Ef:Do("SendCommand")

MsgInfo( Len( WideToAnsi( AnsiToWide( Extension ) ) ) == Len( Extension ) )

............. I get this error..

Unrecoverable error 9023
hb_xgrab requested to allocate zero bytes


What does it mean ?
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Wed Jun 07, 2006 5:36 pm

Adolfo,

Where are the docs or samples for VtArrayWrapper() ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Adolfo » Wed Jun 07, 2006 7:08 pm

Antonio Linares wrote:Adolfo,

Where are the docs or samples for VtArrayWrapper() ?


Antonio

This is what I found in the "what's New" of Xharbour.com February Release

# Renamed class VT to VTWrapper, and VTArray to VTArrayWrapper.
# Added [] and "FOR EACH" operator overloading for VTArrayWrapper().
# Added auto wrapping of non VT_VARIANT arrays with VTarrayWrapper() class.

Nevertheless, If I don't Use VtArrayWrapper(), and try to do this... in FWH

Extension:=Chr(0) + Chr(0)
Ef:DO("AddDataField",Extension)

I get the same problem... no Bytes added to the string sent to the Com port

Thanks..
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Wed Jun 07, 2006 9:38 pm

Adolfo,

Please try this again without using VT... :

MsgInfo( Len( WideToAnsi( AnsiToWide( Extension ) ) ) == Len( Extension ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Adolfo » Thu Jun 08, 2006 12:31 am

Antonio Linares wrote:Adolfo,

Please try this again without using VT... :

MsgInfo( Len( WideToAnsi( AnsiToWide( Extension ) ) ) == Len( Extension ) )


Here is my code and the results

Extension:=CHR(0) + CHR(0)

Alert(len(Extension)) -> 2
Alert(Len(AnsiToWide( Extension ))) -> 1
MsgInfo( Len( WideToAnsi(AnsiToWide(Extension))) == Len(Extension)) -> .F.

Now loking in some other stuff I have to do with the OCX I realize that I'll need to use CHR(0) + Chr(3), not only Zeroes but mixed with values between 1-15

The problem is that I need It to use with Both xHarbour Compilers, for 2 very big and different projects, that's why the solution found in xHb.com is not suitable for xHarbour.org, so I need it to be done with FWH.

Thanks again for your time
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Thu Jun 08, 2006 6:27 am

Adolfo,

Thats what I was thinking, that FWH AnsiToWide() is not properly managing the zeroes:

Extension:=CHR(0) + CHR(0)

Alert(len(Extension)) -> 2
Alert(Len(AnsiToWide( Extension ))) -> 1

We are going to review it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Thu Jun 08, 2006 6:44 am

Adolfo,

We are emailing you a modified FiveHC.lib. Please try it. Thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Adolfo » Thu Jun 08, 2006 12:49 pm

Antonio

Thanks a lot...

I'm Gonna try it, I'll send you any result I'll get

Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Adolfo » Thu Jun 08, 2006 1:46 pm

Antonio...

I replace Fivehc.lib with the one you sent me.
Please Try This..... Either with xHarbour/xHarbour.com

//-----------------------------------------------------------------------------------
Function Main()
Local Extension

Extension:=chr(2) + Chr(1)
MsgStop(len(Extension),"Extension 1 Len()")
MsgStop(Len(AnsiToWide( Extension )),"Extension 1 Len(AnsiToWide)")
MsgInfo( Len( WideToAnsi(AnsiToWide(Extension))) == Len(Extension))

Extension:=chr(0) + Chr(1)
MsgStop(len(Extension),"Extension 2 Len()")
MsgStop(Len(AnsiToWide( Extension )),"Extension 2 Len(AnsiToWide)")
MsgInfo( Len( WideToAnsi(AnsiToWide(Extension))) == Len(Extension))

Extension:=Chr(0) + Chr(0)
MsgStop(len(Extension),"Extension 3 Len()")
MsgStop(Len(AnsiToWide( Extension )),"Extension 3 Len(AnsiToWide)" )
MsgInfo( Len( WideToAnsi(AnsiToWide(Extension))) == Len(Extension))

Return Nil
//----------------------------------------------------

My results for Chr(2) + Chr(1)
Len() -> 2
Len(AnsiToWide(ext)) -> 5
= .T.

My results for Chr(0) + Chr(1)
Len() -> 2
Len(AnsiToWide(ext)) -> 1
= .F.

My results for Chr(0) + Chr(0)
Len() -> 2
Len(AnsiToWide(ext)) -> 1
= .F.

The Problems still remains with Chr(0)

:-(
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby Antonio Linares » Thu Jun 08, 2006 2:08 pm

Adolfo,

Please try it with Harbour (not xHarbour) as xharbour provides another AnsiToWide() that probably is getting used instead of FWH's one.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 45 guests