📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Public fMainForm As frmMain
'</BOOK_ADDON Chapter 5.5.2.2> *****************************************
Public Const DeluxeCDVolume = "\My Documents\DeluxeCD.cdb"
Const keySend = "Send"
Const keyReceive = "Receive"
Const keyExit = "Exit"
Const ID_NEW = 301
Const ID_DELETE = 302
Const ID_SEARCH = 303
Const ID_EDIT = 304
Const ID_TRACKS = 305
Const ID_ADONEXT = 306
Const ID_ADOPREV = 307
Const ID_ADOFIRST = 308
Const ID_ADOLAST = 309
Public Sub InitCommandbar(myForm)
Dim mnuMain As CommandbarLib.CommandBarMenuBar
Dim mnuFile As CommandbarLib.Item
Dim cmdBtn As CommandBarButton
' Assigns the ImageList to the Command Bar
'myForm.ImageList1.Add App.Path & "\PCDMCE.bmp"
myForm.CommandBar1.ImageList = myForm.ImageList1.hImageList
' Adds the File Menu to the Command Bar
Set mnuMain = myForm.CommandBar1.Controls.Add(cbrMenuBar, "MainMenu")
Set mnuFile = mnuMain.Items.Add(1, "File", "File")
mnuFile.SubItems.Add , keySend, "Send"
mnuFile.SubItems.Add , keyReceive, "Receive"
mnuFile.SubItems.Add , "", "", cbrMenuSeparator
mnuFile.SubItems.Add , keyExit, "Exit"
'Adds all our Buttons to the Command Bar
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Style = cbrSeparator
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Image = 0
cmdBtn.Caption = "N"
cmdBtn.Tag = ID_NEW
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Image = 1
cmdBtn.Caption = "D"
cmdBtn.Tag = ID_DELETE
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Style = cbrSeparator
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Image = 2
cmdBtn.Tag = ID_SEARCH
cmdBtn.Caption = "S"
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Image = 3
cmdBtn.Tag = ID_EDIT
cmdBtn.Caption = "E"
Set cmdBtn = myForm.CommandBar1.Controls.Add(cbrButton)
cmdBtn.Image = 4
cmdBtn.Caption = "T"
cmdBtn.Tag = ID_TRACKS
End Sub
'</BOOK_ADDON Chapter 5.5.2.2> *****************************************
Public Sub Main()
'Set fMainForm = New frmMain </BOOK_CHANGE Chapter 5.5.2.2> *****************************************
frmMain.Show
End Sub
'<BOOK_ADDON Chapter 5.5.2.2> *****************************************
'*******************************************************************
'* GetFirstCDRecord() - Gets the first CD record, and place
'* it into the global
'* buffer. Returns True if a record was found,
'* else returns False.
Public Function GetFirstCDRecord(tRS, sql, ByRef CDR) As Boolean
tRS.Open sql, DeluxeCDVolume, adOpenKeyset, adLockReadOnly, adCmdText
If (tRS.EOF) Then
ReDim CDR(tRS.Fields.Count, 0)
tRS.Close
GetFirstCDRecord = False
Else
CDR = tRS.GetRows(1)
GetFirstCDRecord = True
End If
End Function
'******************************************************************************************
'* GetNextCDRecord() - Gets the next record from the already open recordset, and
'* place it into the global buffer. Returns True if a record was
'* found, else returns False. Will close the recordset when no more records are found.
Public Function GetNextCDRecord(tRS, ByRef CDR) As Boolean
If (tRS.EOF) Then
ReDim CDRecordCDE(tRS.Fields.Count, 0)
tRS.Close
GetNextCDRecord = False
Else
CDR = tRS.GetRows(1)
GetNextCDRecord = True
End If
End Function
'</BOOK_ADDON Chapter 5.5.2.2> *****************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -