Solved

Using DLL in VFP

Posted on 2010-08-31
8
1,818 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:ssmith8047
  • 3
  • 3
  • 2
8 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 33570482
You may try (in Command window):

DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll
? getPitchValue()

DECLARE INTEGER setPitchValue IN mainmediaaudiopitch.dll ;
   INTEGER lnPitch

? setPitchValue(5)
? getPitchValue()

0
 

Author Comment

by:ssmith8047
ID: 33570634
DECLARE INTEGER getPitchValue IN mainmediaaudiopitch.dll       && OK - NO ERROR
? getPitchValue()    && RESULTS IN " Cannot Find entry point getPitchValue in the DLL. "
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33570873
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.
0
 

Author Comment

by:ssmith8047
ID: 33571141
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.  
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:ssmith8047
ID: 33571166
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33571396
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...
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33572182
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.
0
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 33577735
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:
http://support.microsoft.com/?scid=kb%3Ben-us%3B305471&x=14&y=17

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now