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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i create a DLL using VFP 6.0? 1

Status
Not open for further replies.

sohrab100

Programmer
Jan 18, 2002
56
HK
I have some function want store it into a DLL file for other foxpro application to use later, how can i create a dll using foxpro and what i need to add?

For example, I have a procedure or function

Procedure proca
****do something
endproc

Function funca
Para para1, para2
****do something
****return something
endfunc sohrab100
 
Hi Sohrab,

First, you need to build your functions into a class. Create a class based on Custom, and make each of your functions a method of the class.

Store the class in its own class library. Store the class library in a new project. Then build the project, using the "Single-threaded COM server (DLL)" option.

In the program that calls your functions, instantiate the class (for example, using CREATEOBJECT()), then go ahead and call the methods.

If the application is to run on a different computer, you need to distribute the DLL to that computer, and register it, using REGSVR32.

The above is just an overview, if you need any more help, ask.

Mike Lewis
Edinburgh, Scotland
 
sohrab100,
As Mike hinted at, VFP can only create COM server .DLLs and they can't have any visual components - messageboxes, printing, wait windows, etc.

Rick
 
Rick, I did not know about the NO Visual components in a com server DLL! What could you put in? Any function that simply returns a value, no action?

Frank
 
Frank,
I guess I should have worded that a bit more carefully. A COM DLL can'tause any visual user interface to appear, it's not that you can't use VFP's visual tools to create the components in it. The reason behind this is because a COM server could be running on a remote server, and if it pops up a meesagebox or form, there wouldn't be anyone to see it or respond to it. Unfortunately before VFP 8.0, this includes the visible &quot;Printing...&quot; dialog that a report will always create and this is a no, no. Other than these UI restrictions, you can put anything in a COM DLL - including a form, just as long as you never Show() it! <g>

You are correct though, most COM DLLs are used to provide information. Table lookups, encryption services, HTML web page strings, etc. You could even write a full Database Server application that allows you to play with a &quot;true&quot; VFP data based client-server application!

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top