📄 frmerase.frm
字号:
VERSION 5.00
Begin VB.Form frmErase
BackColor = &H00F1E7DA&
BorderStyle = 3 'Fixed Dialog
Caption = "Erase Re-Writable CD"
ClientHeight = 1875
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 5490
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1875
ScaleWidth = 5490
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancel
Caption = "&Cancel"
Height = 375
Left = 4065
TabIndex = 4
Top = 525
Width = 1215
End
Begin VB.CheckBox chkQuikErase
BackColor = &H00F1E7DA&
Caption = "Perform Quick Erase"
Height = 225
Left = 300
TabIndex = 1
Top = 180
Value = 1 'Checked
Width = 2160
End
Begin VB.CommandButton cmdErase
Caption = "&Erase"
Height = 375
Left = 4065
TabIndex = 0
Top = 90
Width = 1215
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 = 240
Left = 1140
TabIndex = 3
Top = 1560
Width = 3210
End
Begin VB.Label lblEraseMsg
BackColor = &H00F1E7DA&
Caption = $"frmErase.frx":0000
Height = 960
Left = 285
TabIndex = 2
Top = 495
Width = 3525
End
End
Attribute VB_Name = "frmErase"
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 mblnErasing 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 cmdCancel_Click()
On Error GoTo ErrHandler
'Unload
Unload Me
Exit Sub
ErrHandler:
End Sub
Private Sub cmdErase_Click()
On Error GoTo ErrHandler
'Sheck to see if drive is CDRW
If mobjCDR.GetDriveCapability(WritesCDRW) = False Then
MsgBox "Selected drive does not support Re-Writable discs.", vbOKOnly + vbInformation, App.Title
Unload Me
Exit Sub
End If
'Check to see if disc is erasable
If mobjCDR.IsDiscRewritable() = False Then
MsgBox "Disc is not a Re-Writable disc.", vbOKOnly + vbInformation, App.Title
Unload Me
Exit Sub
End If
'Erase Disc..Quick ?
If mobjCDR.EraseDisc(chkQuikErase.Value = vbChecked) = False Then
'Erase command not accepted
MsgBox "Error Erasing Disc!!!", vbCritical, App.Title
Unload Me
End If
Exit Sub
ErrHandler:
End Sub
Public Sub ShowErase(objCDR As CDWriterXP)
On Error GoTo ErrHandler
'Set an instance of CDR so we can capture events on this form
Set mobjCDR = objCDR
'Enable buttons
cmdCancel.Enabled = True
cmdErase.Enabled = True
'Set flag to false
mblnErasing = False
'Show me
Me.Show vbModal
Exit Sub
ErrHandler:
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
'Dont allow exit if erasing
If mblnErasing = True Then
Cancel = 1 'Cancel Exit
Exit Sub
End If
'Kill form level object
Set mobjCDR = Nothing
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_EraseComplete()
On Error GoTo ErrHandler
'Send a message to the user that erase is complete
lblStatus.Caption = "Erase operation complete!!!"
MsgBox "Erase Completed!!!", vbOKOnly + vbInformation, App.Title
'Enable buttons
cmdCancel.Enabled = True
cmdErase.Enabled = True
'Set flag to false so we can unload the form
mblnErasing = False
'Unload
Unload Me
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_ErasingDisc()
On Error GoTo ErrHandler
'Set flag to True so we cannot unload the form until we are done erasing
mblnErasing = True
'Send message to user
'lblStatus.Caption = "Erasing Disc...Please Wait!!"
lblStatus.Caption = "擦除光盘……请稍等!!"
'Disable buttons
cmdCancel.Enabled = False
cmdErase.Enabled = False
Exit Sub
ErrHandler:
End Sub
Private Sub mobjCDR_WriteError(ByVal WriteError As CDWriterXPLib.eWriteError, ByVal DeviceError As CDWriterXPLib.eCDError)
On Error GoTo ErrHandler
Dim strErrorMsg As String
'Get the error message from public function in module 'Globals'
strErrorMsg = GetWriteErrorMessage(mobjCDR, WriteError, DeviceError)
'Show error message
MsgBox strErrorMsg, vbCritical, App.Title
'Reset buttons so we can unload
cmdCancel.Enabled = True
cmdErase.Enabled = True
'Set flag so the user can unload the form
mblnErasing = False
Exit Sub
ErrHandler:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -