Link to home
Start Free TrialLog in
Avatar of dplambert
dplambert

asked on

Declare Function can't find DLL

I'm working on a card game for fun and I'm using Microsoft's cards.dll for graphics. On the development machine, the VB app can find the DLL which is present in c:\WINNT\system32\cards.dll. On a test machine, the DLL is not found but it's present in c:\Windows\System\cards.dll.

Here's some code that hits the DLL:

----
Private Declare Function cdtInit Lib "cards" ( _
    lngDeckWidth As Long, _
    lngDeckHeight As Long _
) As Long
----

I would assume that VB looks first in the computer's system folder for any file named "cards" with a DLL extension. This folder could be different between machines.

What's the problem?
Avatar of CJ_S
CJ_S
Flag of Netherlands image

First it looks in it's own directory, and after that in the system32 folder. Best thing for you to do is to create a setup-file for your application. You can use the tool package & Deployment wizard for that.

CJ
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada 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
Makes sense since the cards.dll is in the system directory instead of the system32 :-)

CJ
Avatar of dplambert
dplambert

ASKER

Are you saying that a 16-bit DLL can't be used by VB 6.0?
Yes, a 16 bit DLL cannot be called from 32 bit VB code.  You have to use the 32 bit DLL.  Renaming it prevents it from screwing up Win9x card games (overwriting cards.dll) when installed on a Win9x system.
You hit it on the head! Thanks a lot.
I'd like to note that if placed in the same folder as the .exe, it can't find Cards32.dll. I have to put it in the system folder.