Activex difference between FWH/XHB
Activex difference between FWH/XHB
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.
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
With this codeAntonio Linares wrote:Adolfo,
Please try this code:
MsgInfo( Len( WideToAnsi( AnsiToWide( <cData> ) ) ) == Len( <cData> ) )
where <cData> is the bytes string you send.
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
AntonioAntonio Linares wrote:Adolfo,
Where are the docs or samples for VtArrayWrapper() ?
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Here is my code and the resultsAntonio Linares wrote:Adolfo,
Please try this again without using VT... :
MsgInfo( Len( WideToAnsi( AnsiToWide( Extension ) ) ) == Len( Extension ) )
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio
Thanks a lot...
I'm Gonna try it, I'll send you any result I'll get
Adolfo
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
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)
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
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: