sean815
asked on
Initializing cards.dll ???
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?
If you do not had MSVC++ 4.0 installed you can mail the dll to me and I'll check it for you.
Opps, my email add was kokang@hotmail.com
Here is a better answer A VB version. Save text below as card.ctl
VERSION 5.00
Begin VB.UserControl ctlCard
BackColor = &H0 0C0C0C0&
ClientHeight = 243 0
ClientLeft = 0
ClientTop = 0
ClientWidth = 187 5
ScaleHeight = 162
ScaleMode = 3 'Pixel
ScaleWidth = 125
ToolboxBitmap = "ct lCard.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(KeyAs cii As Integer)
RaiseEvent KeyPress(KeyAscii)
End Sub
Private Sub UserControl_MouseDown(Butt on As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseDown(Button, Shift)
End Sub
Private Sub UserControl_MouseMove(Butt on 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.PaintP icture m_customPicture, 0, 0, Width, Height, 0, 0, Width, Height, vbSrcCopy
Else
'drawCard DC centerX CenterY Cardfa ce U P 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("Card Face", m_cardface)
CardBack = PropBag.ReadProperty("Card Back", m_cardBack)
CardDrawMode = PropBag.ReadProperty("Card DrawMode", m_cardDrawMode)
CardSideVisible = PropBag.ReadProperty("Card SideVisibl e", 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_WritePropertie s(PropBag As PropertyBag)
Call PropBag.WriteProperty("Car dFace", m_cardface, CF_CLUBS10)
Call PropBag.WriteProperty("Car dBack", m_cardBack, CB_ACESINHAND)
Call PropBag.WriteProperty("Car dDrawMode" , m_cardDrawMode, CDW_REGULAR)
Call PropBag.WriteProperty("Car dSideVisib le", m_cardsidevisible, CSV_FACEUP)
End Sub
Public Sub Flip()
CardSideVisible = IIf(m_cardsidevisible = CSV_FACEUP, CSV_FACEDOWN, CSV_FACEUP)
End Sub
VERSION 5.00
Begin VB.UserControl ctlCard
BackColor = &H0
ClientHeight = 243
ClientLeft = 0
ClientTop = 0
ClientWidth = 187
ScaleHeight = 162
ScaleMode = 3
ScaleWidth = 125
ToolboxBitmap = "ct
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(KeyAs
RaiseEvent KeyPress(KeyAscii)
End Sub
Private Sub UserControl_MouseDown(Butt
RaiseEvent MouseDown(Button, Shift)
End Sub
Private Sub UserControl_MouseMove(Butt
RaiseEvent MouseMove(Button, Shift)
End Sub
Private Sub UserControl_MouseUp(Button
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.PaintP
Else
'drawCard DC
X% = DrawCard(hdc, 0, 0, card, drawmode, RGB(255, 255, 255))
End If
End Sub
Private Sub UserControl_ReadProperties
CardFace = PropBag.ReadProperty("Card
CardBack = PropBag.ReadProperty("Card
CardDrawMode = PropBag.ReadProperty("Card
CardSideVisible = PropBag.ReadProperty("Card
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_WritePropertie
Call PropBag.WriteProperty("Car
Call PropBag.WriteProperty("Car
Call PropBag.WriteProperty("Car
Call PropBag.WriteProperty("Car
End Sub
Public Sub Flip()
CardSideVisible = IIf(m_cardsidevisible = CSV_FACEUP, CSV_FACEDOWN, CSV_FACEUP)
End Sub
ASKER
No, I dont have c++, but Mirkwoods comment was just what i needed
ASKER
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?
I have a sample VB project which demonstrates the usage of cards.dll. Let me know your email address if you want it.
sunj
sunj
ASKER
That would be great,Ill try it out. Thanks
My email: sean@yours.com
My email: sean@yours.com
sunj , can you please send it to Inteqam@usa.net too.
:0)
:0)
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
sunj
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.