Solved

Declare Function can't find DLL

Posted on 2002-04-30
7
179 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 60
vb6, excel Run-time error 1004 method 'close' of object 'workbooks' failed 7 54
How to make an ADE file by code? 11 87
Recommendation vb6 to vb.net or others 14 150
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

810 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