|
Home > Archive > FoxPro Help and Support > December 2005 > Calling a COM DLL from VFP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Calling a COM DLL from VFP
|
|
| MDKimzey 2005-12-02, 11:24 am |
| I have a DLL developed in C++ that I would like to use in a VFP application.
From the object browser, I can drag an interface to a PRG and flesh out a
class. However, when I call the method nothing happens (no errors - just
nothing).
Are there any examples or documentation that show how a C++ COM DLL can be
used from VFP? (Most articles address creating VFP DLLs).
| |
| Olaf Doschke 2005-12-02, 11:24 am |
| > From the object browser, I can drag an interface to a PRG and flesh out a
> class. However, when I call the method nothing happens (no errors - just
> nothing).
To do this is helpful, if you want to create a vfp class that
acts as an eventhandler for the com server and reacts
to events. This new class has by default no code in it.
It's not inheriting methodcode from the comserver, it's
just inheriting the structure.
If you just want to use a com server, you simply create
it with
oCom = Createobject("my.comserver")
....
eg.
oExcel = Createobject("Excel.Application")
Bye, Olaf.
| |
| Christian Ehlscheid 2005-12-02, 1:24 pm |
| Hello,
it depends on the actual COM dll if you can use it at all.
Low level COM is one of Fox's weaknesses, you can only use COM interfaces
that inherit from the IDispatch interface,
also called automation interfaces.
If your COM dll inherits it's interfaces directly from "IUnknown" you cannot
call it from VFP at all, and your only option is to write a wrapper COM
object in C++ (ATL), VB, Delphi or another language that supports non
automation interfaces.
If you aren't the author of the COM dll, you can check in the "object
browser" from which interface your COM dll's interfaces derive.
Regards
Christian
|
|
|
|
|