Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any experience with com interop net dll access from VFP?
Message
From
15/06/2008 21:01:20
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Any experience with com interop net dll access from VFP?
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01324297
Message ID:
01324297
Views:
75
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 from VFP. When I connect to it from VFP, it returns an integer for the connection. The api for the net com interop dll 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.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Reply
Map
View

Click here to load this message in the networking platform