Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why can't VFP use any DLL

Status
Not open for further replies.

LorenC

Programmer
Dec 31, 2002
13
US

I have a 3rd party DLL that I use and it works great.

They sent me a second DLL to use in another part of my program and the
project manager gives error "DLL is Invalid"

What advice can I give to 3rd party on how to make DLL for VFP ?

What DLL can VFP use ?

Thanks
Loren
 
Hi Craig,

I really don't know what kind they give me.
They are C++ programers and don't know much about VFP.

The funny thing is the first DLL works great but the second won't work with vfp.

I was wondering what I could tell them on how to make or compile the DLL in there C++ program so it would work in vfp. It's purpose is automation client.

Should they make a COM DLL or a WIN32 DLL ?

Any Ideas
 
VFP can use either COM or "regular" DLL's... the difference is how you access them in VFP.

COM dll's are accessed by calling CREATEOBJECT('class.name') or NEWOBJECT(),

regular DLL's are accessed with DECLARE statements.


If VFP can't access a function in the DLL using DECLARE, and throws the "DLL is Invalid" error, then maybe there really is something wrong with the DLL... I don't know much about the options that C++ can use to build them, though, to know what could go wrong.
 
and the project manager gives error "DLL is Invalid"

What exactly do you mean by this? I mean are you saying youa re getting this error when you try and add the DLL to your project? What are you trying to do with the DLL or what is the code you wrote to try and use it?

To find out if a DLL is a COM or C dll you can try and open it up from the object browser. From within VFP system menu TOOLS - OBJECT BROWSER now try and open your dll in there. If it comes up with all of it's info then it is a COM DLL otherwise it is a C DLL. The difference is important as wgcs has pointed out the way you access/use it from within VFP is completely different.


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
It must be a regular DLL because
This is how it is used in declare statement:

DECLARE INTEGER ym_connectionstate IN YMBG32.DLL INTEGER, STRING, STRING, STRING, STRING, INTEGER

then in code it's used like so:

result = ym_connectionstate(0, ' ,'' ,'' ,15)

It takes up to 6 params and the DLL contacts a server with the information and returns an integer.

Thanks
 

My declare statement is like this:

DECLARE INTEGER ym_connectionstate IN YMBG32.DLL INTEGER, STRING, STRING, STRING, STRING, INTEGER

I have commented out any commands using this DLL in my code so the program and project doesn't use it.

When I use the Project Manager and compile an .exe
it reads the declare statement and comes up with the error "ymbg32.dll is invalid", WHY ????

I'm really stumped....
 
Is this DLL in the Windows "system" directory or in the applications current directory? (VFP may not be able to locate this file.) Are you sure the entry point is really "ym_connectionstate"? DLL DECLAREs are case sensitive - i.e. ym_connectionstate is not the same as ym_ConnectionState or YM_connectionstate , etc.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top