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?
LVL 3
dplambertAsked:
Who is Participating?
 
PaulHewsConnect With a Mentor Commented:
I think the problem is that on Win9x, the cards.dll is a 16 bit DLL.  You can fix this by copying the NT Cards.dll, renaming it to Cards32.dll and including that in your setup program.  Then make all your calls to the Cards32 library instead.
0
 
CJ_SCommented:
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
0
 
CJ_SCommented:
Makes sense since the cards.dll is in the system directory instead of the system32 :-)

CJ
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
dplambertAuthor Commented:
Are you saying that a 16-bit DLL can't be used by VB 6.0?
0
 
PaulHewsCommented:
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.
0
 
dplambertAuthor Commented:
You hit it on the head! Thanks a lot.
0
 
dplambertAuthor Commented:
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.
0
All Courses

From novice to tech pro — start learning today.