Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

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?
0
dplambert
Asked:
dplambert
  • 3
  • 2
  • 2
1 Solution
 
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
 
PaulHewsCommented:
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:
Makes sense since the cards.dll is in the system directory instead of the system32 :-)

CJ
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now