Link to home
Start Free TrialLog in
Avatar of Jaymol
Jaymol

asked on

Using DLL's with no reference.

Hi.

I just wondered how I'd go about using a function in a DLL if I didn't know how it was declared.

For example, if there was a function called 'MessageBox' in a DLL called msg.dll and it needed to be called like this....

   MessageBox('This is the message', 'This is the title');

....how would I know how to do that?  If I opened the DLL within Quickview, for example, it would say that there was a function called 'MessageBox', but not give me any reference on how to use it.

Can anyone help me with this?

John.
ASKER CERTIFIED SOLUTION
Avatar of robert_marquardt
robert_marquardt

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
Avatar of Jaymol
Jaymol

ASKER

So are you saying that it is 100% impossible to find out this information purely from the DLL?

John.
As i have understood it's not possible to get the parameter types from the dll, only the number of parameters and/or the complete size of all the parameters.

I'm not sure of this but this is what my memory tells me...

//raidos
Avatar of Jaymol

ASKER

Okay.  So if I have the DLL(s) and the C header file(s), I can do it then?

John.
With the C headers it is no problem at all.
Post some function headers here and i will help you convert them to Pascal.
Also have a look at http://dlephi-jedi.org page 'API Library'.
We specialize in converting C headers to Pascal.
If you have no C(++) headers, you could still try to reverse-engineer (disassemble) the dll. I'm not sure whether this is allowed  :-)  but, well, that's a different story. By disassembling the dll's code, you can find out how many parameters the function wants and - if you completely disassemble the function and understand it fully, you'll most probably also find out what the parameters mean. But I have to warn you: This is very very very hard work. You should do that only as the very last resort. If you have ANY chance to get a C(++) include file: Use that chance...

Regards, Madshi.
Avatar of Jaymol

ASKER

Thanks Madshi, but I'm not going down the route you've mentioned since you're probably the only person that comes on this site capable of doing something like that!  I did disassemble it, rather than using Quickview, to see the funcs/procs and it did give me more information, but I've "aquired" the C++ files so (as suggested by Robert) I can attempt a conversion.  There's probably gonna be a lot of C to Pascal points going from my account soon!

I'll have a look into my options and get back to do pointy things.

Thanks guys.

John.
Project JEDI has many C to Pascal specialists (and i am one of them :-)
Please send me the headers to robert_marquardt@gmx.de and i will have a look.
C++ headers may be problematic if C++ methods are exported.
C++ methods are unusable in Delphi.
Avatar of Jaymol

ASKER

Thanks guys.