Hello,

This is a snippit from a VBScript routine.

Dim PINPad
Dim ResultString

Set PINPad = WScript.CreateObject("OPOS.PINPad")

WScript.ConnectObject PINPad, "EventHandler_"

The ConnectObject is my trouble. How would I do that in VB6?

Thanks

Re: This in VB6? by Tim

Tim
Wed Jul 18 22:48:38 CDT 2007

At a guess you would declare PINPad "With Events".

You would then create an event handler routine for each event you're
interested in.
Consult the API documentation for exposed events.
http://www.magtek.com/documentation/public/99875144-3.pdf

Tim




"ninefofo" <ninefofo@gmail.com> wrote in message
news:1184802770.808905.171810@m37g2000prh.googlegroups.com...
>
> Hello,
>
> This is a snippit from a VBScript routine.
>
> Dim PINPad
> Dim ResultString
>
> Set PINPad = WScript.CreateObject("OPOS.PINPad")
>
> WScript.ConnectObject PINPad, "EventHandler_"
>
> The ConnectObject is my trouble. How would I do that in VB6?
>
> Thanks
>



Re: This in VB6? by mr_unreliable

mr_unreliable
Thu Jul 19 12:40:02 CDT 2007

ninefofo wrote:
> The ConnectObject is my trouble. How would I do that in VB6?
>

hi Ninefofo,

Tim Williams is right. The "WithEvents" declaration goes along
with referencing the object's typelib in your (vb) project.

Then vb can use the typelib to set up any event handlers that
you want.

But then, if you are going to reference the typelib, you may as
well just use "early-binding" rather than "late-binding" (i.e.,
just forget about CreateObject).

Scripting is different from vb in that all objects are "late-
bound" (except for the intrinsic built-in objects). And so
you have the WScript.CreateObject that includes connecting
to events, or ConnectObject for those situations where you
are getting access to an object some other way.

While you would be well advised to follow Tim Williams advice
and use "WithEvents", there is a way to connect events in vb
_WITHOUT_ access to the typelib.

It involves examining the ole interface (from code, of course),
and winds up doing the same thing as scripting's ConnectObject,
except in a different way.

If you want to check it out (for extreme techies only), read
Carlo Randone's: "COM: Handle Late-bound Events within Visual
Basic Using an ATL Bridge" (with code), found here:

http://msdn.microsoft.com/msdnmag/issues/01/03/connpoints/

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


Re: This in VB6? by Tim

Tim
Thu Jul 19 12:45:55 CDT 2007

The exposed events are documented in the link included in my reply.

Tim


"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:uWQFttiyHHA.464@TK2MSFTNGP02.phx.gbl...
> ninefofo wrote:
>> The ConnectObject is my trouble. How would I do that in VB6?
>>
>
> hi Ninefofo,
>
> Tim Williams is right. The "WithEvents" declaration goes along
> with referencing the object's typelib in your (vb) project.
>
> Then vb can use the typelib to set up any event handlers that
> you want.
>
> But then, if you are going to reference the typelib, you may as
> well just use "early-binding" rather than "late-binding" (i.e.,
> just forget about CreateObject).
>
> Scripting is different from vb in that all objects are "late-
> bound" (except for the intrinsic built-in objects). And so
> you have the WScript.CreateObject that includes connecting
> to events, or ConnectObject for those situations where you
> are getting access to an object some other way.
>
> While you would be well advised to follow Tim Williams advice
> and use "WithEvents", there is a way to connect events in vb
> _WITHOUT_ access to the typelib.
>
> It involves examining the ole interface (from code, of course),
> and winds up doing the same thing as scripting's ConnectObject,
> except in a different way.
>
> If you want to check it out (for extreme techies only), read
> Carlo Randone's: "COM: Handle Late-bound Events within Visual
> Basic Using an ATL Bridge" (with code), found here:
>
> http://msdn.microsoft.com/msdnmag/issues/01/03/connpoints/
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>



thanks by mr_unreliable

mr_unreliable
Thu Jul 19 16:35:42 CDT 2007

Tim Williams wrote:
> The exposed events are documented in the link included in my reply.
>

Thanks. If I ever need to provide programming support for
MagTek devices, I'll know where to go...

cheers, jw