Condividi tramite


Access to External Libraries

In most cases, Visual FoxPro provides all the tools you need to complete your application. However, occasionally you might find that an application requires additional functionality not already available in Visual FoxPro. In those cases, you can reach outside Visual FoxPro and take advantage of the capabilities of external libraries.

Visual FoxPro makes it possible for you to access these kinds of external libraries:

  • ActiveX controls (.ocx files) and Objects. ActiveX controls and objects are programs that include objects designed to accomplish specific tasks. Most ActiveX controls and objects add new objects to Visual FoxPro — everything from a new type of text box to a calendar, calculator, or other complex object. Some ActiveX controls and objects also incorporate additional facilities, such as access to your e-mail system or to the communications ports on your computer. As a rule, after incorporating an ActiveX control or object into Visual FoxPro, you can use the objects in them as you would any Visual FoxPro base class.
  • Dynamic-link libraries (.dll files). A .dll file is a library of functions that you can call from Visual FoxPro programs as you would any user-defined function in Visual FoxPro. Many Windows programs — and Windows itself — make their functionality available using .dll files. For example, you can access the system color settings for Windows by linking to a system .dll file and calling functions in it.
  • Visual FoxPro external libraries (.fll files). An .fll file is like a .dll file, but uses special protocol for sharing data with Visual FoxPro, and often contains calls to internal Visual FoxPro functions. As a consequence, .fll files are specific to Visual FoxPro, unlike .dll files, which can be called from any Windows program. You can call the functions in an .fll as you would any user-defined function in Visual FoxPro.

Before you use any library, you must be familiar with the conventions used to access its controls or functions. For example, if you want to include an ActiveX control on a form, you must know what properties, events, and methods you can use to manage the control. For an ActiveX control, you can use a Visual FoxPro Class Browser to determine the properties, events, and methods you can use. Similarly, if you want to call a function in a .dll file, you must know the function name, the number and data types of the parameter it requires, and the data type of its return value. In general, you can obtain this type of information from the documentation that accompanies a library, whether in a book or a Help system. For information about system .dll files for Windows, you can refer to the Software Development Kit (SDK) appropriate to your version of Windows.

See Also

Extending Visual FoxPro with External Libraries | Accessing ActiveX Controls and Objects | Accessing Dynamic-Link Libraries | Accessing a Visual FoxPro Library | Accessing the Visual FoxPro API