You are not logged in.

Manuel

Administrator

  • "Manuel" is male
  • "Manuel" started this thread

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

1

Friday, August 22nd 2008, 1:04am

Invoke Methods

You have several options to call a method with Jabaco. I'll explain the differents.

The fastest method is calling a known object:

Jabaco Source

1
2
3
4
'1) Create a "Known Object": 
   Dim mySocket As New VB#Winsock 
   mySocket.Connect "127.0.0.1", 1234
   MsgBox mySocket.RemoteHost

Using the Variant-Type to call a method. Internal it will use reflections so it is slightly slow:

Jabaco Source

1
2
3
4
'2) Assign the Object to Variant:
   Dim myVariant As Variant = mySocket
   myVariant.Connect "127.0.0.1", 1234
   MsgBox mySocket.RemoteHost

Same like the Variant-Method, but little verbosely:

Jabaco Source

1
2
3
4
5
'3) Using the CallByName-Method:
   Dim myArgs(1) As String
   myArgs(0) = "127.0.0.1"
   myArgs(1) = 1234
   CallByName mySocket, "Connect", VBMethod, ""

This is the background of 'CallByName'. More verbosely, but also more powerfull:

Jabaco Source

1
2
'4) Java Reflections:
   'See: http://java.sun.com/docs/books/tutorial/reflect

Similar threads

Rate this thread
WoltLab Burning Board