Foxpro 2.6a for Windows RegFn call
I have to replace an existing dll call that is registered and called using RegFn and CallFn respectively.
I am trying to write the dll using C# in the hope that as long as the function signature match and the dll is in the right place it will work.
so
pnHndl= RegFn("CALCULATE", "I", "I", "AJons.DLL")
pnRetVal = CallFn(pnHndl, 0)
My code is as follows:
[Guid("EAB7C2CD-2471-4BDA-90E9-F70403BAA557")]
[ComVisible(true)]
public class AJons : _AJons
{
[ComVisible(true)]
public int CALCULATE(int value)
{
return value * 2;
开发者_如何转开发}
}
Foxpro doesn't play ball I just get 'could not load library AJon.dll'
Does anyone have any experience here?
Cheers.
From what I can see, those really old RegFn and CallFn are for calling Win32 native Dlls - completely different from COM.
What you need to create a Win32 dll that will work with those functions is C++.
What you should do (if you HAVE to keep using FoxPro) is at least use the latest version of VFP.
written on my iPhone
Update 1
1) Just in case I wasn't clear, you cannot make this kind of DLL from .NET.
2) Have a look at this link here for a very simple example of how to write a Win32 dll.
精彩评论