This operator overloads the class’s lookup operator. While functional, it doesn’t look or feel as nice as the VB equivalent. The equivalent Xojo code (without use of Operator_Lookup or ParamArray) would look something like this: Dim Cnxn As New OLEObject("ADODB.Connection") Under the hood, the Cnx4.Open call is communicating with the ADO component via IDispatch by looking up the “Open” method and Invoking that function if it exists. Set Cnxn = CreateObject("ADODB.Connection")Ĭnxn4.Open("Pubs", "MyUserId", "MyPassword") For example, this is how one could use the ADO COM component to open a database connection using VB: Dim Cnxn As Object The interface has methods to obtain a list of properties/methods that the COM component exposes and a way to Invoke them. At the high level view of this interface it is much like Introspection. This interface is used by automation clients (like Xojo and VB) to access the COM component. The need grew out from having to support COM on Windows.įirst, let’s take a look at COM and its IDispatch interface. Operator_Lookup and ParamArray are two language features that have been in Xojo for a while now, but most probably don’t know why they were originally added.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |