Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Com Interop with Net DLL and Callbacks
Message
From
16/06/2008 02:28:08
 
 
To
15/06/2008 20:47:25
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01324295
Message ID:
01324312
Views:
15
Tracy,

first try to get the dotnet working by an example in dotnet. If you don't have the source, look for one of the tools recreating source from the IL (if you are lucky there is testcode in the dll as well showing proper usage<g>).

You have at least a dot missing in the code shown here when setting your name, so this probably would leave
loAObject.CallerName as .f. && 'Tracy C Holzer' goes to loAObjectCallerName
which could mean some different values for the corresponding property depending how defensive
loAPI.SetAVals(loAObject)
was coded. I would also try
loAPI.GetAVals( (loAObject.id) )

or
lcGUID = loAObject.id
loAPI.GetAVals(lcGUID)

probably missing some sleep...

regards

thomas


>I have a com interop net dll that I did not create, nor can I modify. It has an api that I can use to communicate with it. When I connect to it, it returns an integer for the connection. The api has numerous methods I can call to send information or request information. I can send fine, but I cannot receive. According to the documentation, the information is received via a callback. I have looked at vfp callback examples for com, but all of them appear to be examples where the com dll is created by the developer and I do not have control over that. How do I manage a callback when I call the net com interop dll?
>
>The connection is made via tcp through a port you can choose (I chose 5000). For testing purposes, I am running the cache app (c# net dll) on my machine using 127.0.0.1 and connecting to it via the api (net com interop dll) from VFP on my workstation as well.
>
>The documentation states that information is returned via a callback, but looking at the layout for the aclass connect, I see no callback information.
>
>Connect (int Port, string AppName, CallBack CallBackFunction): int
>Creates a connection to CACH application. Each AppName can register a separate
>callback function. The caller checks the connection status through the registered callback
>function.

>
>???
>However, in the object browser, I only see: Connect(port)
>no other parameters show.
>
>I connect like so:
>
>
>*--  Method Connect(Port As Long) As Long     && no callback in this definition is there?
>*--  Member of a_CachStandardAPI.aClass
>
>*--Connect
>PUBLIC loAPI as a.CachStandardAPI.aClass
>loAPI = CREATEOBJECT("a.CachStandard.API.aClass","","")
>public lnport
>lnport = 5000
>lnConnection =  loAPI.connect(lnport)  && returns integer 10 for a successful connection
>
>
>*--Populate the ab object's properties
>lcguid=getguid()  && a routine I use to generate a guid
>Public loAObject as a.CachStandardAPI.abClass  && another class in the com dll that holds information
>loAObject = CREATEOBJECT("a.CachStandard.API.abclass","","")
>loAObject.ID = lcGuid
>loAObject.CallbackNumber = '1234567890'
>loAObject.CallerNumber = '0987654321'
>loAObject.callerlocation = '100 N Main St;HP'
>loAObjectCallerName = 'Tracy C Holzer'
>
>*--Send the object to the com dll
>*--  Method SetAvals(obj As _abClass) As Long
>*--  Member of a_CachStandardAPI.aClass
>
>loAPI.SetAVals(loAObject)  && works - I can see the object properties in the net com dll
>
>
>Now, if I modify the information in the net com dll directly, I should be able to request an update using a method in the API:
>
>*--  Method GetAvals(CallID As GUID) As _abClass
>*--  Member of a_CachStandardAPI.aClass
>
>loAPI.GetAVals(loAObject.id)  && returns 'OLE error code 0x80004002: No such interface supported'
>
>Any idea why it would return 'No such interface supported' when I can clearly see the interface in the object browser and I can see it as well if I step through the interfaces using:
>
>*--This shows the interfaces and the GetAvals is listed
>public otli, otlb
>otli=NEWOBJECT('tli.tliapplication')
>otlb=otli.TypeLibInfoFromFile("a.CachStandardAPI.tlb")
>FOR each oCoClass in otlb.CoClasses
>   ?"  ",oCoClass.name
>   *now each interface associated with this CoClass
>   for each oInterface in oCoClass.Interfaces
>      ?"     ",oInterface.name
>   endfor
>endfor
>?
>?"Interfaces"
>FOR each oInterface in otlb.Interfaces
>   ?"  ",oInterface.name
>ENDFOR
>?
>FOR i = 1 TO otlb.Interfaces.Count
>    ?"Interface Members for Interface "+ALLTRIM(STR(i))
>	FOR each oMember IN otlb.Interfaces(i).Members
>	   ?"       ", oMember.name
>	   FOR each oParm in oMember.Parameters
>	      ?"                   ",oParm.name
>	   ENDFOR
>	ENDFOR
>ENDFOR
>RETURN
>
>
>However, I can see the method and the interface in the object browser. It's supposed to return the abObject populated.
>
>Any ideas?
>
>Although the supplier of the dll created a com interop dll at my request, they do not seem to have anyone experienced in com interop. So there is not much support there. They work with dotnet almost exclusively and not any com interop.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform