Solved

Declare Function can't find DLL

Posted on 2002-04-30
7
174 Views
Last Modified: 2010-05-02
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
Comment
Question by:dplambert
  • 3
  • 2
  • 2
7 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6980701
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
 
LVL 38

Accepted Solution

by:
PaulHews earned 50 total points
ID: 6980960
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
 
LVL 22

Expert Comment

by:CJ_S
ID: 6980990
Makes sense since the cards.dll is in the system directory instead of the system32 :-)

CJ
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 3

Author Comment

by:dplambert
ID: 6981085
Are you saying that a 16-bit DLL can't be used by VB 6.0?
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6981103
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
 
LVL 3

Author Comment

by:dplambert
ID: 6981456
You hit it on the head! Thanks a lot.
0
 
LVL 3

Author Comment

by:dplambert
ID: 6981502
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now