Solved

Initializing cards.dll ???

Posted on 1998-12-04
11
168 Views
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?
0
Comment
Question by:sean815
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 3

Expert Comment

by:Sendoh
Comment Utility
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.
0
 
LVL 3

Expert Comment

by:Sendoh
Comment Utility
If you do not had MSVC++ 4.0 installed you can mail the dll to me and I'll check it for you.
0
 
LVL 3

Expert Comment

by:Sendoh
Comment Utility
Opps, my email add was kokang@hotmail.com
0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Here is a better answer A VB version. Save text below as card.ctl

VERSION 5.00
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
End
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 (arjen.bos@Cyco.nl)
'**************** %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
'Parameters:
'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
'RETURNS TRUE IF SUCCESSFUL

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
'RETURNS TRUE IF SUCCESSFUL

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_DIAMONDSA = 1
    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_DIAMONDSJ = 41
    CF_DIAMONDSQ = 45
    CF_DIAMONDSK = 49
    
    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_REDBLUEHATCH = 54
    CB_CROSSHATCH = 55
    CB_ROBOT = 56
    CB_ROSES = 57
    CB_GREENIVY = 58
    CB_BLUEIVY = 59
    CB_REDFISH = 60
    CB_REDFISHBLUEBACK = 61
    CB_SEASHELL = 62
    CB_CASTLE = 63
    CB_PALMTREE = 64
    CB_ACESINHAND = 65
    CB_CUSTOM = 66
End Enum

Public Enum CardDrawMode
    CDW_REGULAR = 0
    CDW_HILITE = 2
    CDW_GHOST = 3
    CDW_REMOVE = 4
    CDW_INVISIBLEGHOST = 5
End Enum

Public Enum CardSideVisible
    CSV_FACEUP = 0
    CSV_FACEDOWN = 1
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
'************************************************************

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

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

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

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

'CardDrawMode
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
    Refresh
End Property

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


'CardSideVisible
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
    Refresh
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
        Refresh
    Else
        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
        Else
            card = m_cardface
        End If
    Else
        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
    Else
        '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)
    Refresh
End Sub

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

Private Sub UserControl_Show()
    Refresh
End Sub

Private Sub UserControl_Terminate()
    'Free Memory :)
    EndCard
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
0
 

Author Comment

by:sean815
Comment Utility
No, I dont have c++, but Mirkwoods comment was just what i needed
0
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

 

Author Comment

by:sean815
Comment Utility
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?
0
 
LVL 1

Expert Comment

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

sunj
0
 

Author Comment

by:sean815
Comment Utility
That would be great,Ill try it out. Thanks
My email: sean@yours.com
0
 
LVL 7

Expert Comment

by:Inteqam
Comment Utility
sunj , can you please send it to Inteqam@usa.net too.

:0)

0
 
LVL 1

Expert Comment

by:sunj
Comment Utility
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.

sunj

0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
Comment Utility
Since my comment seems to be what you neededd
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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.
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…
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…

744 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

9 Experts available now in Live!

Get 1:1 Help Now