Initializing cards.dll ???

Posted on 1998-12-04
Last Modified: 2010-05-03
What is the declare function statement for the cards.dll for win95? I have an old cards.bas, but I get an error that it can't locate the dll, so is there a different command for the 32bit version?
Question by:sean815
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
  • 3
  • 2
  • +2

Expert Comment

ID: 1448153
Hi !

You can use the bumpbin.exe(MSVC++ 4.0) to view the exports functions from the dll. Based on that, you can declare it on VB.

Hope this is what you expected.

Expert Comment

ID: 1448154
If you do not had MSVC++ 4.0 installed you can mail the dll to me and I'll check it for you.

Expert Comment

ID: 1448155
Opps, my email add was
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

LVL 13

Expert Comment

ID: 1448156
Here is a better answer A VB version. Save text below as card.ctl

Begin VB.UserControl ctlCard
   BackColor       =   &H00C0C0C0&
   ClientHeight    =   2430
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   1875
   ScaleHeight     =   162
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   125
   ToolboxBitmap   =   "ctlCard.ctx":0000
Attribute VB_Name = "ctlCard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

'**************** %2 CardCtrl
'**************** %4 Arjen Bos (
'**************** %7 15-01-1998

'**************** PRIVATE DECLARATIONS

'Function Declarations for CARDS.DLL
Private Declare Function CardInit Lib "CARDS.DLL" Alias "cdtInit" (PointX As Long, PointY As Long) As Long
' Pointers to Card coordinates, returns TRUE if succesful

Private Declare Function DrawCard Lib "CARDS.DLL" Alias "cdtDraw" (ByVal hdc As Long, ByVal PointX As Long, ByVal PointY As Long, ByVal card As Long, ByVal drawmode As Integer, ByVal BkGrnd As Long) As Long
'hDC-    HDC of window to draw cards on
'x,y -   Upper left hand point
'Card -   Card # (Use CONSTANTS)
'Mode-  Draw Mode for Card, see Constants
'BkGrnd-    An RBG Long value of the Background color for the drawn card

Private Declare Function DrawCardEX Lib "CARDS.DLL" Alias "cdtDrawExt" (ByVal hdc As Long, ByVal PointX As Long, ByVal PointY As Long, ByVal ExtX As Integer, ByVal ExtY As Integer, ByVal card As Integer, ByVal drawmode As Integer, ByVal BkGrnd As Long) As Integer
' Extended drawing fuction, allows for nonstandard card sizes.
'Same params as above plus:
'ExtX, ExtY-    Lower right hand corner of Card, used to stretch or shrink Cards to specific sizes

Private Declare Sub EndCard Lib "CARDS.DLL" Alias "cdtTerm" ()
'Call when you are finshed with the DLL.

Private Const SRCCOPY = &HCC0020

Public Enum CardFace
    CF_NONE = -1
    CF_CLUBSA = 0
    CF_CLUBS2 = 4
    CF_CLUBS3 = 8
    CF_CLUBS4 = 12
    CF_CLUBS5 = 16
    CF_CLUBS6 = 20
    CF_CLUBS7 = 24
    CF_CLUBS8 = 28
    CF_CLUBS9 = 32
    CF_CLUBS10 = 36
    CF_CLUBSJ = 40
    CF_CLUBSQ = 44
    CF_CLUBSK = 48
    CF_DIAMONDS2 = 5
    CF_DIAMONDS3 = 9
    CF_DIAMONDS4 = 13
    CF_DIAMONDS5 = 17
    CF_DIAMONDS6 = 21
    CF_DIAMONDS7 = 25
    CF_DIAMONDS8 = 29
    CF_DIAMONDS9 = 33
    CF_DIAMONDS10 = 37
    CF_HEARTSA = 2
    CF_HEARTS2 = 6
    CF_HEARTS3 = 10
    CF_HEARTS4 = 14
    CF_HEARTS5 = 18
    CF_HEARTS6 = 22
    CF_HEARTS7 = 26
    CF_HEARTS8 = 30
    CF_HEARTS9 = 34
    CF_HEARTS10 = 38
    CF_HEARTSJ = 42
    CF_HEARTSQ = 46
    CF_HEARTSK = 50
    CF_SPADESA = 3
    CF_SPADES2 = 7
    CF_SPADES3 = 11
    CF_SPADES4 = 15
    CF_SPADES5 = 19
    CF_SPADES6 = 23
    CF_SPADES7 = 27
    CF_SPADES8 = 31
    CF_SPADES9 = 35
    CF_SPADES10 = 39
    CF_SPADESJ = 43
    CF_SPADESQ = 47
    CF_SPADESK = 51
    CF_X = 54
    CF_O = 55
End Enum

Enum CardBack
    CB_ROBOT = 56
    CB_ROSES = 57
    CB_GREENIVY = 58
    CB_BLUEIVY = 59
    CB_REDFISH = 60
    CB_SEASHELL = 62
    CB_CASTLE = 63
    CB_PALMTREE = 64
    CB_CUSTOM = 66
End Enum

Public Enum CardDrawMode
    CDW_HILITE = 2
    CDW_GHOST = 3
    CDW_REMOVE = 4
End Enum

Public Enum CardSideVisible
    CSV_FACEUP = 0
End Enum

'**************** PRIVATE VARIABLES

'The front of the card
Private m_cardface As CardFace

'The back of the card
Private m_cardBack As CardBack

'The drawmode
Private m_cardDrawMode As CardDrawMode

'Card side visible
Private m_cardsidevisible As CardSideVisible

'A custom background
Private m_customPicture As IPictureDisp

Private m_height As Long
Private m_width As Long

'**************** PUBLIC EVENTS

Public Event MouseMove(Button As Integer, Shift As Integer)
Public Event MouseUp(Button As Integer, Shift As Integer)
Public Event MouseDown(Button As Integer, Shift As Integer)
Public Event Click()
Public Event DblClick()
Public Event KeyPress(KeyAscii As Integer)

'**************** PUBLIC ROUTINES

Public Property Let CardFace(ByVal theCardFace As CardFace)
    m_cardface = theCardFace
End Property

Public Property Get CardFace() As CardFace
    CardFace = m_cardface
End Property

Public Property Let CardBack(ByVal theCardBack As CardBack)
    m_cardBack = theCardBack
End Property

Public Property Get CardBack() As CardBack
    CardBack = m_cardBack
End Property

Public Property Let CardDrawMode(ByVal theCardDrawMode As CardDrawMode)
    If (theCardDrawMode <> CDW_REGULAR And m_cardsidevisible = CSV_FACEDOWN) Then
        Err.Raise -1, "ctlCard", "Only drawmode regular is allowed when card side is facedown"
    End If
    m_cardDrawMode = theCardDrawMode
End Property

Public Property Get CardDrawMode() As CardDrawMode
    CardDrawMode = m_cardDrawMode
End Property

Public Property Let CardSideVisible(ByVal theCardSideVisible As CardSideVisible)
    If (m_cardDrawMode <> CDW_REGULAR And theCardSideVisible = CSV_FACEDOWN) Then
        Err.Raise -1, "ctlCard", "Only drawmode regular is allowed when card side is facedown"
    End If
    m_cardsidevisible = theCardSideVisible
End Property

Public Property Get CardSideVisible() As CardSideVisible
    CardSideVisible = m_cardsidevisible
End Property

Public Property Set CustomPicture(ByVal newValue As IPictureDisp)
    If (Ambient.UserMode = True) Then
        Set m_customPicture = newValue
        Err.Raise -1, "ctlCard", "Property cannot be modified at design time"
    End If
End Property

Public Property Get CustomPicture() As IPictureDisp
    Set CustomPicture = m_customPicture
End Property

'**************** PRIVATE EVENT HANDLERS

Private Sub UserControl_Initialize()
    m_cardface = CF_CLUBS10
    m_cardBack = CB_ACESINHAND
    m_cardDrawMode = CDW_REGULAR
    m_cardsidevisible = CSV_FACEUP
    'Call Init to set points
    Call CardInit(m_width, m_height)
End Sub

Private Sub UserControl_KeyPress(KeyAscii As Integer)
    RaiseEvent KeyPress(KeyAscii)
End Sub

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseDown(Button, Shift)
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseMove(Button, Shift)
End Sub

Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseUp(Button, Shift)
End Sub

Private Sub UserControl_Click()
    RaiseEvent Click
End Sub

Private Sub UserControl_DblClick()
    RaiseEvent DblClick
End Sub

Private Sub UserControl_Paint()
    Dim X As Integer
    Dim card As Long
    Dim drawmode As Long
    If (m_cardDrawMode = CDW_REGULAR) Then
        drawmode = m_cardsidevisible
        If (m_cardsidevisible = CSV_FACEDOWN) Then
            card = m_cardBack
            card = m_cardface
        End If
        drawmode = m_cardDrawMode
        card = m_cardface ' Only face is supported
    End If
    If (card = CB_CUSTOM) Then
        UserControl.PaintPicture m_customPicture, 0, 0, Width, Height, 0, 0, Width, Height, vbSrcCopy
        'drawCard     DC    centerX    CenterY    Cardface       UP or DOWN     WHITE
        X% = DrawCard(hdc, 0, 0, card, drawmode, RGB(255, 255, 255))
    End If
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    CardFace = PropBag.ReadProperty("CardFace", m_cardface)
    CardBack = PropBag.ReadProperty("CardBack", m_cardBack)
    CardDrawMode = PropBag.ReadProperty("CardDrawMode", m_cardDrawMode)
    CardSideVisible = PropBag.ReadProperty("CardSideVisible", m_cardsidevisible)
End Sub

Private Sub UserControl_Resize()
    Height = m_height * 15
    Width = m_width * 15
End Sub

Private Sub UserControl_Show()
End Sub

Private Sub UserControl_Terminate()
    'Free Memory :)
End Sub

'Write properties
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("CardFace", m_cardface, CF_CLUBS10)
    Call PropBag.WriteProperty("CardBack", m_cardBack, CB_ACESINHAND)
    Call PropBag.WriteProperty("CardDrawMode", m_cardDrawMode, CDW_REGULAR)
    Call PropBag.WriteProperty("CardSideVisible", m_cardsidevisible, CSV_FACEUP)
End Sub

Public Sub Flip()
    CardSideVisible = IIf(m_cardsidevisible = CSV_FACEUP, CSV_FACEDOWN, CSV_FACEUP)
End Sub

Author Comment

ID: 1448157
No, I dont have c++, but Mirkwoods comment was just what i needed

Author Comment

ID: 1448158
I saved the above txt file as card.ctl, but when i attempt to draw it on my form ,I get the classic RunTime Error 48, cards.dll not found, I also tried giving the control a direct route to my dll, but no luck. Any suggestions?

Expert Comment

ID: 1448159
I have a sample VB project which demonstrates the usage of cards.dll. Let me know your email address if you want it.


Author Comment

ID: 1448160
That would be great,Ill try it out. Thanks
My email:

Expert Comment

ID: 1448161
sunj , can you please send it to too.



Expert Comment

ID: 1448162
Sorry sean815 and Inteqam... I made a careless mistake. As I downloaded the sample project quite long time ago, I forgot that it is also a 16-bit version. I am sure that would not help so much...My sincere apology.


LVL 13

Accepted Solution

Mirkwood earned 100 total points
ID: 1448163
Since my comment seems to be what you neededd

Featured Post

Industry Leaders: 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

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses
Course of the Month4 days, 13 hours left to enroll

635 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