Building a VFP DLL
Building the DLL is little different from the regular process of building a FoxPro
executable. Create a new project and add the program which defines the class to this
project. Click the
button on the Project Manager but then select
instead of the "executable" option.
The build process will create an in-process COM server as vfpcustomer.dll and will also
create the Type Library file (vfpcustomer.tlb) and the Registration Information file
(vfpcustomer.vbr). You'll need all three when you come to distribute the system.
The final option on the Project Manager's
Build Options dialog is for a
.
This can give better performance on a system with multiple processors but requires more
thought and is probably not worthwhile on something that is just an intermediate stage
in the migration.
Register the DLL
In order to make the new FoxPro DLL available to external programs you need to register it
with Windows. The easiest way to do this is to run the RegSvr32 command from the Windows
command line. You should get the simple message box as shown here on the left to show
that the DLL has been registered successfully.
These examples come from Windows XP. If you are running Windows 7 then you must run
regsvr32 as an administrator.
Select and then
then right-click on
and select
. If you forget to do this then you
will get an message quoting error number 0x80070005. A search on the web for this error
will show that many people have made the same mistake.
If the process fails under XP then you'll get a less helpful message like the one below.
The problem is usually that the name or the path to the file is wrong.
The next steps
The first two steps in this process were to
write
and
test
a DLL in VFP. The final step is to
call
it from Visual Basic or C#.
|