Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with TLB and DLL .net in visual foxpro

Status
Not open for further replies.

kenwall123

IS-IT--Management
Mar 28, 2012
13
US
Hi dude
I have still problem with dll in visual foxpro!!
I have .NET DLL:" POS_PC.DLL which has POS_PC.TLB " its PIN PAD terminal DLL.
I attach the instruction of this DLL.
How can I call functions and set the setting in visual foxpro.
I have no problem with VB and C#. but in foxpro using dll make some problems for me.
 
I have registered the dll with tlb sub commands and I see it in VB references but in VFP in object browser I should browse the tlb file to see the main class.
 
You need to register it with REGASM before VFP will be able to use it.

Bye, Olaf.
 
as I mentioned before I have registered with that command.
I don't know how cam I use the functions in this tbl file.
I can browse tbl file with Object browser.
 
The object browser gives you no more and no less than an overview of the class. To use any COM class you need CreateObject():

o = Createobject("com.classname") && replace with whatever class name your class has. And then you can call any mathod of it:

o.method(param1, param2)

Or set any property (or rather Fields, as dotnet nomenclature is):

o.property = Value


Bye, Olaf.
 
Dear Olaf
maybe my question is absurd but I have to ask.
I am familiar with basic concepts of VFP but not with those classes.
something that I don't understand is that I don't know How can I call and use a function!! in this example of DLL TLB there is some functions and Properties like something I am having done in Visual C# and VB6.I don't know what is "classname"? is it name of the function which is in the dll ? what is classname!!??
I have a dll sample code in both platform it would be very nice to undrestand.if I have a real sample code comparing VFP with C# it would be very nice.Sorry if I drive you crazy ;)
thank you
 
As you talk of TLB, this means you have TypeLiB information. And this only is valid for a DLL with COM/OLE classes in it.

If the DLL has no classes in it, object browser wouldn't show anything.

You'll find the class name in the class browser.

If you generated the TLB via REGASM yourself, this may have been futile, the DLL may not have any COM interop layer in it, then it can't be used in VFP.

Bye, Olaf.
 
There's another type of DLLs foxpro actually does support: C++ DLLs (or also other languages) with functions in it supporting the typical legacy style calling conventions cdecl, fastcall... (see Those functions can be used by a DECLARE DLL.

I must disappoint you, though: That doesn't apply to any .NET DLL.

The only thing that could help you then is writing a wrapper in C#. See what Rick Strahl writes about such assemblies here at the heading "Using .Net classes that don't work with COM":


Bye, Olaf.
 
kenwall,

I think you need to step back and understand COM in general.

Download and read the first two sections on reviewing COM and creating COM components in VFP. That will give you the basics to apply to the .Net component you have.

Craig Berntson
MCSD, Visual C# MVP,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top