📄 frmdiscinfo.frm
字号:
VERSION 5.00
Begin VB.Form frmDiscInfo
BackColor = &H00F1E7DA&
BorderStyle = 3 'Fixed Dialog
Caption = "Disc Info"
ClientHeight = 3720
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4620
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3720
ScaleWidth = 4620
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame fraInfo
BackColor = &H00F1E7DA&
Height = 2010
Left = 255
TabIndex = 3
Top = 135
Width = 4170
Begin VB.Label lblValueDiscStatus
BackColor = &H00F1E7DA&
Caption = "N/A"
Height = 240
Left = 1980
TabIndex = 13
Top = 1290
Width = 2010
End
Begin VB.Label lblDiscStatus
BackColor = &H00F1E7DA&
Caption = "Disc Status:"
Height = 240
Left = 330
TabIndex = 12
Top = 1290
Width = 1470
End
Begin VB.Label lblValueFreeSpaceBlocks
BackColor = &H00F1E7DA&
Caption = "N/A"
Height = 240
Left = 1980
TabIndex = 11
Top = 1605
Width = 2010
End
Begin VB.Label lblFreeSpace
BackColor = &H00F1E7DA&
Caption = "Free Space Blocks:"
Height = 240
Left = 330
TabIndex = 10
Top = 1605
Width = 1470
End
Begin VB.Label lblValueDiscType
BackColor = &H00F1E7DA&
Caption = "N/A"
Height = 240
Left = 1980
TabIndex = 9
Top = 975
Width = 2010
End
Begin VB.Label lblDiscType
BackColor = &H00F1E7DA&
Caption = "Disc Type:"
Height = 240
Left = 330
TabIndex = 8
Top = 975
Width = 1470
End
Begin VB.Label lblValueLastSessionStatus
BackColor = &H00F1E7DA&
Caption = "N/A"
Height = 240
Left = 1980
TabIndex = 7
Top = 660
Width = 2010
End
Begin VB.Label lblSessionStatus
BackColor = &H00F1E7DA&
Caption = "Last Session Status:"
Height = 240
Left = 330
TabIndex = 6
Top = 660
Width = 1470
End
Begin VB.Label lblValueSessions
BackColor = &H00F1E7DA&
Caption = "N/A"
Height = 240
Left = 1980
TabIndex = 5
Top = 345
Width = 2010
End
Begin VB.Label lblSessions
BackColor = &H00F1E7DA&
Caption = "Number of Sessions:"
Height = 240
Left = 330
TabIndex = 4
Top = 345
Width = 1470
End
End
Begin VB.CommandButton cmdCloseDisc
Caption = "Close Disc"
Height = 375
Left = 1755
TabIndex = 2
Top = 2640
Width = 1395
End
Begin VB.CommandButton cmdCloseSession
Caption = "Close Session"
Height = 375
Left = 300
TabIndex = 1
Top = 2640
Width = 1395
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Height = 375
Left = 3660
TabIndex = 0
Top = 2640
Width = 780
End
Begin VB.Label lblStatus
Alignment = 2 'Center
BackColor = &H00F1E7DA&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 720
TabIndex = 14
Top = 2205
Width = 3165
End
End
Attribute VB_Name = "frmDiscInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents mobjCDR As CDWriterXP
Attribute mobjCDR.VB_VarHelpID = -1
Private mblnClosing As Boolean
'****************************************************************
'****************************************************************
'COPYRIGHT 2001 NUGROOVZ
'This is a sample of how you could use the CDWriterXP control.
'There are improvements which could be made rather easily.
'Feel free to modify it as you see fit.
'****************************************************************
'****************************************************************
Private Sub cmdCloseDisc_Click()
On Error GoTo ErrHandler
mblnClosing = True
cmdOK.Enabled = False
cmdCloseDisc.Enabled = False
cmdCloseSession.Enabled = False
'Call close last session method
If mobjCDR.CloseLastSession(True) = False Then
MsgBox "关闭光盘发生错误!", vbCritical, App.Title
mblnClosing = False
cmdOK.Enabled = True
cmdCloseDisc.Enabled = True
cmdCloseSession.Enabled = True
End If
'Events will tell us if it succeeded or not
Exit Sub
ErrHandler:
End Sub
Private Sub cmdCloseSession_Click()
On Error GoTo ErrHandler
mblnClosing = True
cmdOK.Enabled = False
cmdCloseDisc.Enabled = False
cmdCloseSession.Enabled = False
'Call close last session method
If mobjCDR.CloseLastSession(False) = False Then
'MsgBox "Error attempting to Close Session!", vbCritical, App.Title
MsgBox "关闭会话发生错误!", vbCritical, App.Title
mblnClosing = False
cmdOK.Enabled = True
cmdCloseDisc.Enabled = True
cmdCloseSession.Enabled = True
End If
'Events will tell us if it succeeded or not
Exit Sub
ErrHandler:
End Sub
Private Sub cmdOK_Click()
On Error GoTo ErrHandler
Unload Me
Exit Sub
ErrHandler:
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
If mblnClosing = True Then
Cancel = 1
Exit Sub
End If
'Set instance to nothing
Set mobjCDR = Nothing
Exit Sub
ErrHandler:
End Sub
Public Sub ShowDiscInfo(objCDR As CDWriterXP, frmParent As Form)
On Error GoTo ErrHandler
'Set local object
Set mobjCDR = objCDR
'Check for media
If mobjCDR.IsMediaLoaded() = False Then
MsgBox "No Media Loaded...Cannot Get Disc Info!", vbOKOnly + vbInformation, App.Title
Unload Me
Exit Sub
End If
'Show Form
Me.Show , frmParent
'Get Disc Information
SetStatus
Exit Sub
ErrHandler:
End Sub
Private Sub SetStatus()
On Error GoTo ErrHandler
'Default these to not enabled
cmdCloseDisc.Enabled = False
cmdCloseSession.Enabled = False
'Reset this flag
mblnClosing = False
'Set number of Sessions
lblValueSessions.Caption = mobjCDR.GetSessionCount()
'Free Space blocks
lblValueFreeSpaceBlocks.Caption = mobjCDR.GetDiscFreeSpaceBlocks(wtpData)
'Set Disc Status label
Select Case mobjCDR.GetDiscStatus()
Case dsComplete
lblValueDiscStatus.Caption = "Disc is Closed"
Case dsEmpty
lblValueDiscStatus.Caption = "Empty Disc"
Case dsIncomplete
lblValueDiscStatus.Caption = "Disc Open"
Case dsUnknown
lblValueDiscStatus.Caption = "Unknown"
End Select
'Set Disc Type label
Select Case mobjCDR.GetDiscType()
Case dtCddaCDRom 'Audio or Mode1 CDRom
lblValueDiscType.Caption = "CD-DA/CD-ROM"
Case dtCDI
lblValueDiscType.Caption = "CDI"
Case dtCDRomXA
lblValueDiscType.Caption = "CD-ROM XA"
Case dtUnknown
lblValueDiscType.Caption = "Unknown"
End Select
'Set Last Session Status
Select Case mobjCDR.GetLastSessionStatus()
Case ssEmpty
lblValueLastSessionStatus.Caption = "Empty Session"
Case ssIncomplete
lblValueLastSessionStatus.Caption = "Incomplete Session"
'Let User Close disc/session
cmdCloseSession.Enabled = True
cmdCloseDisc.Enabled = True
Case ssComplete
lblValueLastSessionStatus.Caption = "Closed Session"
Case ssReserved
lblValueLastSessionStatus.Caption = "Unknown"
End Select
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_ClosingSession()
On Error GoTo ErrHandler
lblStatus.Caption = "...Closing Session/Disc..."
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_WriteError(ByVal WriteError As CDWriterXPLib.eWriteError, ByVal DeviceError As CDWriterXPLib.eCDError)
On Error GoTo ErrHandler
'Show msg to user
MsgBox "Error closing Session/Disc #" & DeviceError, vbCritical, App.Title
mblnClosing = False
Unload Me
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_WritingComplete()
On Error GoTo ErrHandler
'Close is complete
lblStatus.Caption = "Closing Successful!!"
SetStatus
MsgBox "Session/Disc Closed Successful!", vbInformation + vbOKOnly, App.Title
mblnClosing = False
cmdOK.Enabled = True
Exit Sub
ErrHandler:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -