Using DLL in VFP

Trying to use a DLL with foxpro. help is vague on how to do this. OCX are drag and drop oleobjects,this don't work that way.

using mainmediaaudiopitch.dll in Foxpro.
methods are:
getPitchValue - returns int
setPitchValue - param int
getTempoValue - returns int
setTempoValue - param int

This Dll won't show up in Foxpro contrl list, seems to add without error, but I do not find it in controls list. It registered ok with regsvr32.
 I have used createobject like

LOCAL oPitcher


but it says class definition not found

Who is Participating?

Improve company productivity with a Business Account.Sign Up

Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
By the way: The central function that is the only way to make the implementation of an interface useful is EventHandler(oCOMObject,oVFPObject,.T.). That's why I said you need a COM Server reference. In the EventHandler Function the oCOMObject must be an object instance of a COM class which has an interface based on IDispatch and oVFPObject must be a foxpro class implementing that interface, in this case the IAudioPitch interface.

And then the foxpro object code will run, when events occur in the COM object. Just having the VFP object itself will not work, events don't get passed to any object instance implementing an interface automatically. So an interface is of limited use to foxpro.

You can see a working example using the EventHandler() binding of COM to a VFP object here:

This is just to illustrate what is possible and how. I fear you will lack the needed COM reference to use Eventhandler with the interface implementation of the DirectShow/DirectSound Filter the MainMediaSoft DLL offers.

Bye, Olaf.
You may try (in Command window):

DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll
? getPitchValue()

DECLARE INTEGER setPitchValue IN mainmediaaudiopitch.dll ;
   INTEGER lnPitch

? setPitchValue(5)
? getPitchValue()

ssmith8047Author Commented:
DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll       && OK - NO ERROR
? getPitchValue()    && RESULTS IN " Cannot Find entry point getPitchValue in the DLL. "
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Olaf DoschkeSoftware DeveloperCommented:
As you say it works with regsrv32 wihtout error, it must be OLE, maybe no OCX, but a COM Server, like you can create a COM Server with VFP, but no OCX.

Do you have any documentation, what's he source of that DLL, is it a foxpro DLL?

If it's a COM Server created with foxpro the OLE class name typically has two parts separated by a dot: projectname dot classname.

If it's OLE the foxpro object browser will be able to read the typelib of it, you can browse to the DLL file by opening object browser, click open toolbar button, activate the COM libraries tab and click on the Browse button. Keep filetype as DLL and navigate to the mainmediaaudiopitch.dll

If that errors the DLL does not contain a OLE class and regsvr32 will also fail on it, you may have overlooked an error message of regsvr32.

The phenomenon with DECLARE is normal, the DELARE itself does not check for an entry point, the name of the function is case sensitive and must match the DLL, so that could also be a reason you get an error "cannot find entry point" when using the function.

eg this errors

Declare integer sleep in Kernel32.dll integer milliseconds

this not

Declare integer Sleep in Kernel32.dll integer milliseconds

Bye, Olaf.
ssmith8047Author Commented:
dll and regsvr32 gave success.
dll is third party, there is no other info in file other than methods I listed.
Since i can't see it in foxpro class browser, I don't know if it has two parts and what they are named internally. It does have ole self reg. characters in the file properties.(may mean nothing)
Object browser - when you browse to the file it and choose the file , you get " An Error Occured loading the requested type library " , " The selected file is either invalid or inot a type library"
spelling and case are as they show in help doc, and I tried all lowercase and variants.

Audio Pitch Filter
Interface methods
 setPitchValue Adjustment the pitch value.
 getPitchValue Get the current pitch value.
 setTempoValue Adjustment the tempo value.
 getTempoValue Get the current tempo value.
 setLicenseKey Set the license key after you bought  the full version.  
Audio Pitch Filter is a powerful transform filter that allows change the audio pitch or audio tempo when playback video or audio file in any Directshow base application (Delphi, .Net, vb, vc++).

VFP isn't listed and I don't think it will be easy to implement. You may read, e.g.

Did you ask in MainMediaSoft? They are selling the library, it is rather expensive, so they should know the answer if they are still planning some business...
Olaf DoschkeSoftware DeveloperCommented:
The help explicitly tells to register the dll, okay. But it's nevertheless neither an ActiveX nor a COM Server, you need to implement an Interface. And these interface methods then only work in conjunction with any DirectShow appllication, so the filter does not integrate with any player.

You'll need something along the lines of

DEFINE CLASS audiopitchfilter as custom
IMPLEMENTS IAudioPitch IN {5811086B-1D07-4ce9-A398-8DEC9A2DBD89}

* Methods get/setPitch, get/setTempo

Comlicated and of limited use, you would only be able to bind this Interface implementation to foxpro, if you also can get a COM Object reference, but that would only exist within a DirectShow player.

Looks like you'd need some helper DLL or EXE written in any of the supported languages, eg C#, C++, which then should offer functions you can use in foxpro.

If I were you I'd rather use Bass.DLL from un4seen.

Bye, Olaf.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.