Solved

Declare Function can't find DLL

Posted on 2002-04-30
7
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

695 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