Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
'............................ BRUSH
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private hBrush As Long
'............................ REGIONS
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function PtInRegion Lib "gdi32" (ByVal hRgn As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
Private Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private arRgn(29) As Long
Private rectRemoveCard As RECT
Private iCntRemoveCard As Integer
'............................ CARDS
Private Declare Function cdtInit Lib "Cards.Dll" (Dx As Long, Dy As Long) As Long
Private Declare Function cdtDraw Lib "Cards.Dll" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal iCard As Long, ByVal iDraw As Long, ByVal clr As Long) As Long
Private Declare Function cdtTerm Lib "Cards.Dll" () As Long
'............................ SOUND
' Sounds are played directly from the resource file.
' !!! This feature ONLY works wwhen compiled. !!!
Private Declare Function PlayResWAV Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszName&, ByVal dwFlags&) As Long
Private Const SND_RESOURCE = &H40004 'play from resource
Private Const SND_ASYNC = &H1 'play asynchronously or in other words return immediately after beginning the sound
' Card constants: How are we rendering the card?
Private Const ordFaces As Long = 0 '
Private Const ordBacks As Long = 1
Private Const ordInvert As Long = 2
' card size
Private lWidth As Long
Private lHeight As Long
' In the following types:
' - Number stands for the card number as defined in Cards.dll
' - Value stands for the card value: 1=ace, 2=2, ... King=13
Private Type PLAYBOARD
Left As Long
Top As Long
Number As Integer
Value As Integer
Covered As Integer
Discarded As Boolean
End Type
Private arPlayboard(29) As PLAYBOARD
Private Type DECK
Number As Integer ' card number as difined in Cards.dll
Value As Integer ' card alue: 1=ace, 2=2, ... King=13
Discarded As Boolean
End Type
Private arDeck(23) As DECK
Private iCurrentDeck As Integer
Private Type SELECTED
Index As Integer
Number As Integer
Value As Integer
End Type
Private FirstCard As SELECTED
Private SecondCard As SELECTED
Private iSelected As Integer
Private arCards(51) As Integer
Private arRow(6) As Integer ' index array is row, value is first slot number in that row
Private iBack As Integer
Private swAnimate As Boolean
Private iAnimateSpeed As Integer
Private iOldAnimateIndex As Integer
Private swSound As Boolean
Private Const cReplay As Boolean = True
Private Sub Form_Load()
Dim iRow As Integer
Dim iCol As Integer
Dim iCnt As Integer
Dim lLeft As Long
' init cards DLL
cdtInit lWidth, lHeight
' set card position on each of the seven rows and create regions