Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have answered some questions and have gotten answers for my questions. Anywhere you can do this on one page helps tremendously..."

Geography

Where in the world do Tek-Tips members come from?

Working with TLB and DLL .net in visual foxpro

kenwall123 (IS/IT--Management)
10 Apr 12 1:54
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.
OlafDoschke (Programmer)
10 Apr 12 2:27
Look at this, part II

http://www.codeproject.com/Articles/990/Understanding-Classic-COM-Interoperability-With-NE

You need to compile for com interop with VS.NET
Having a TLB is not enough. The DLL also needs to be registerd. Also you can't use 64bit assemblies, even if their TLB is generated and they are registered.

Bye, Olaf.
kenwall123 (IS/IT--Management)
10 Apr 12 5:32
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.
 
OlafDoschke (Programmer)
10 Apr 12 8:06
You need to register it with REGASM before VFP will be able to use it.

Bye, Olaf.
kenwall123 (IS/IT--Management)
10 Apr 12 13:18
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.
 
OlafDoschke (Programmer)
10 Apr 12 16:04
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.
 
kenwall123 (IS/IT--Management)
11 Apr 12 8:17
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
OlafDoschke (Programmer)
11 Apr 12 8:29
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.
OlafDoschke (Programmer)
11 Apr 12 8:45
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 http://en.wikipedia.org/wiki/X86_calling_conventions). 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":

http://www.west-wind.com/presentations/VfpDotNetInterop/DotNetFromVFP.asp

Bye, Olaf.
craigber (Programmer)
11 Apr 12 10:25
kenwall,

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

Download http://www.craigberntson.com/docs/complus.pdf 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, www.craigberntson.com/blog
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close