Link to home
Start Free TrialLog in
Avatar of ssmith8047
ssmith8047

asked on

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

oPitcher=CREATEOBJECT("mainmediaaudiopitch")

but it says class definition not found

mainmediaaudiopitch.dll
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

You may try (in Command window):

DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll
? getPitchValue()

DECLARE INTEGER setPitchValue IN mainmediaaudiopitch.dll ;
   INTEGER lnPitch

? setPitchValue(5)
? getPitchValue()

Avatar of ssmith8047
ssmith8047

ASKER

DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll       && OK - NO ERROR
? getPitchValue()    && RESULTS IN " Cannot Find entry point getPitchValue in the DLL. "
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
sleep(1)

this not

Declare integer Sleep in Kernel32.dll integer milliseconds
Sleep(1)

Bye, Olaf.
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. http://www.markusegger.com/Articles/Article.aspx?quickid=0606026

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...
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
ENDDEFINE

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.
ASKER CERTIFIED SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial