Try to erase cd if it's not blank before burning.
If I call _IsValidDevice; once, I can't burn CD, because it returns false. So I have to call it twice, and everything works. Why?
Code:
procedure TfmMainForm.OnBurn(Sender: TObject);
var
p_device: ^TDeviceStruct;
begin
p_device := m_working_thread.GetDevices[m_cbDrives.ItemIndex];
if not p_device.isBlank then
if MessageDlg('Disc is not blank. You cannot use it.' + #10#13 +
'Do you want to erase it?', mtWarning, [mbYes, mbNo], 0, mbYes) = mrYes then
begin
with TfmDiskEraser.Create(Application) do ShowModal;
_IsValidDevice;
end;
if _IsValidDevice <> True then
begin
ShowMessage('_IsValidDevice<>True');
end
else
if _IsValidFiles <> True then
begin
ShowMessage('_IsValidFiles<>True');
end
else
_Burn();
end;
Code:
function TfmMainForm._IsValidDevice(): Boolean;
var
p_device: ^TDeviceStruct;
begin
p_device := m_working_thread.GetDevices[m_cbDrives.ItemIndex];
if (p_device.disctype <> DISC_TYPE_CDR) and
(p_device.disctype <> DISC_TYPE_CDRW) then
begin
Result := False;
Application.MessageBox('You must use CDR or CDRW discs only', 'Warning', MB_OK);
Exit;
end;
if not p_device.isBlank then
begin
Result := False;
Application.MessageBox('Disc is not blank. You cannot use it', 'Warning', MB_OK);
Exit;
end;
if not p_device.isWritable then
begin
Result := False;
Application.MessageBox('Disc is not writable. You cannot use it', 'Warning', MB_OK);
Exit;
end;
Result := True;
end;
The first time I get message 'Disc is not blank. You cannot use it', and int second time OK, and I can burn it. If I comment string
Code:
Application.MessageBox('Disc is not blank. You cannot use it', 'Warning', MB_OK);
I get message 'Disc is not writable. You cannot use it'... What happens? Why message
Code:
Application.MessageBox('Disc is not blank. You cannot use it', 'Warning', MB_OK);
makes disk "blank"?
Два дня потратил уже