Jump to content

problem using com with vb strings


 Share

Recommended Posts

Sorry this maybe a bit of noob question but I am bashing my head against a brick wall

com object (written in vb6) has an event i am trying to deal with

vb event handler works fine:-

Private Sub MessageReceived(ByVal T As Integer, M As String, F As Integer)

msgbox(T)

msgbox(M)

msgbox(F)

End Sub

autoit implementation

func MessageReceived($t,$m,$f)

msgbox(1,"",$t)

msgbox(1,"t",$m)

msgbox(1,"",$f)

EndFunc

its called it runs the $t and the Sf variables are correct but the $m one has garbage in it (what should bea string "1" is null null null null null hr 159 null null, "3" "looks about the same!

I presume its because a string is being passed but i jsut cant seem o get my head round what I'm missing!

Someone tell me what a idiot I am being please!

Link to comment
Share on other sites

Its not called at all...in those terms. its part of an addin for an application.

its an event handler to a pre defined vb6 object.

It attaches to a application (object) once the application receives a message it causes the event to run which in turn causes the function to run, the call the n passes the $m into the function, its ab6 application and the variable being passed is a string.

The vb6 code is just the same and it all works, its called, the other two variables populate correctly but the string doesn't - much to my bemusement!

the full code is

$WithEvents = ObjCreate("capsvr40.CapServerLib")

$CapConnector = ObjCreate("capsvr40.capconnect")

$CaptureIT = $CapConnector.CapServerLib

$SinkObject=ObjEvent($captureit,"captureit_")

while 1=1

sleep(5)

wend

func MessageReceived($t,$m,$f)

msgbox(1,"",$t)

msgbox(1,"",$m)

msgbox(1,"",$f)

EndFunc

not elegant (it was till i started simplifying it to try and find the issue!) btu tit works apart from this $m not receiving the string but garbage

many thanks for the interest

Edited by the kick inside
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...