For Programmers: Free Programming Magazines  


Home > Archive > Clarion > January 2006 > Problem with OCX









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with OCX
Bojch

2006-01-19, 7:55 am

Hi to all!

While comunicating with remote HW device through OCX at some point I'm
required to send some ESC sequences.
OCX uses BSTR datatype in SendSequence metod.
When sending ?Ole{'SendSequence('&Chr(27)&Chr(176)&Chr(2)&')'}
the OCX recieves the sequence normaly, but sequences like:
?Ole{'SendSequence('&Chr(27)&Chr(175)&Chr(5)&Chr(10)&Chr(0)&Chr(0)&Chr(0)&Chr(0)&Chr(2)&Chr(2)&Chr(1)&Chr(0)&Chr(0)&Chr(0)&')'}
?Ole{'SendSequence('&Chr(27)&Chr(175)&Chr(1)&Chr(0)&')'}
and many others which contain Chr(0) are nor recieved by OCX.

Thank you!
Bojan



Olivier Cretey

2006-01-19, 6:55 pm

Have you tried to send a string instead of multiple chr() ?

> ?Ole{'SendSequence('&Chr(27)&Chr(175)&Chr(1)&Chr(0)&')'}


?Ole{'SendSequence('<27,175,1,0>')}

Regards

--
Olivier Cretey
o.cretey@cia-informatique.com
www.cia-informatique.com
Verneuil sur Seine (78), France


Bojch

2006-01-20, 3:55 am

Hi!

At first I would like to thank you for your quick responce to my question!
I tryed to send in this form too, but it still won't work. The SendSequence
works if not Instring Chr(0). The OCX requires BSTR and I think this is
PSTRING in clarion.

This is a VisualBasic6 example:
Oman1.SendSequence Chr(&H1B) + Chr(&HAE) + Chr(0) + Chr(2) + Chr(0) + Chr(0)
and I must call the same in the Clarion6.2

If any idea please reply to group! I know that someone has have the same
problem once!?!?

Thank's!
Bojch




"Olivier Cretey" <o.cretey@cia-informatique.com> wrote in message
news:dqodg7$lee$1@biggoron.nerim.net...
> Have you tried to send a string instead of multiple chr() ?
>
>
> ?Ole{'SendSequence('<27,175,1,0>')}
>
> Regards
>
> --
> Olivier Cretey
> o.cretey@cia-informatique.com
> www.cia-informatique.com
> Verneuil sur Seine (78), France
>



Olivier Cretey

2006-01-20, 7:55 am


> The OCX requires BSTR and I think this is PSTRING in clarion.


No, there is no direct equivalent in Clarion.
PString is a length defined string whose first byte stores the lenght, I
do not think your ocx likes that.
As you need to insert chr(0) inside your string, you cant use CStrings:
Chr(0) is used to tell where the end of string is.

In my mind, String type or Array of Bytes have more chances to be the
nearest type.

Some thoughts:

I vaguely remember an OLE BSTR implementation in Clarion6 LibSrc, maybe
you can look how they did it ?

Is your BSTR passed by value or by address ?

Did you add the Raw attribute to your prototype ?

It looks like a printer or a serial port ocx.

Regards

--
Olivier Cretey
o.cretey@cia-informatique.com
www.cia-informatique.com
Verneuil sur Seine (78), France


Leonid Chudakov

2006-01-20, 6:55 pm

Try using double quotes
?Ole{'SendSequence("' & '<27,175,1,0>' & '")'}

--
--
Leonid Chudakov
chudakov@klarisoft.com
Cool tools and Clarion examples at
http://www.klarisoft.com

"Bojch" <bojch@bojch.com> wrote in message
news:27Kzf.139$76.88377@news.siol.net...
> Hi to all!
>
> While comunicating with remote HW device through OCX at some point I'm
> required to send some ESC sequences.
> OCX uses BSTR datatype in SendSequence metod.
> When sending ?Ole{'SendSequence('&Chr(27)&Chr(176)&Chr(2)&')'}
> the OCX recieves the sequence normaly, but sequences like:
> ?Ole{'SendSequence('&Chr(27)&Chr(175)&Chr(5)&Chr(10)&Chr(0)&Chr(0)&Chr(0)&Chr(0)&Chr(2)&Chr(2)&Chr(1)&Chr(0)&Chr(0)&Chr(0)&')'}
> ?Ole{'SendSequence('&Chr(27)&Chr(175)&Chr(1)&Chr(0)&')'}
> and many others which contain Chr(0) are nor recieved by OCX.
>
> Thank you!
> Bojan
>
>
>



Bojch

2006-01-24, 3:55 am

Hi!
Thanks for your answer but it still won't work. I tryed to type code in a
few combinations but I didn't have luck.

I was hoping that someone has had a similar problem and that someone has
used a similar sequence.

If any idea, please write it!!!

Bojch


"Leonid Chudakov" <chudakov@klarisoft.com> wrote in message
news:7C8Af.20796$xk1.552463@news20.bellglobal.com...
> Try using double quotes
> ?Ole{'SendSequence("' & '<27,175,1,0>' & '")'}
>
> --
> --
> Leonid Chudakov
> chudakov@klarisoft.com
> Cool tools and Clarion examples at
> http://www.klarisoft.com
>
> "Bojch" <bojch@bojch.com> wrote in message
> news:27Kzf.139$76.88377@news.siol.net...
>
>



Bojch

2006-01-31, 7:55 am

"Olivier Cretey" <o.cretey@cia-informatique.com> wrote in message
news:dqqfod$1g1k$1@biggoron.nerim.net...
>
> In my mind, String type or Array of Bytes have more chances to be the
> nearest type.
>


A was thinking about Array of bytes to... I will give it a try...

> Some thoughts:
>
> I vaguely remember an OLE BSTR implementation in Clarion6 LibSrc, maybe
> you can look how they did it ?
>


Hmmm, this is something worth looking into...

> Is your BSTR passed by value or by address ?
>


By value

> Did you add the Raw attribute to your prototype ?
>


Raw attribute to OCX? Where, what?

> It looks like a printer or a serial port ocx.
>


It is a serial port OCX, indirectly in this case for BT printer...
www.orderman.com



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com