I am using the Common Dialog Control in VB6 with the purpose to save a copy of a file.
However, if I select the destination to be a removable drive (e.g. USB flash drive),
if I then try to "unplug/eject the hardware" (even though the form used to perform the save is closed)
the messagebox appears "The device 'Generic volume' cannot be stopped right now. Try stopping the device later."
I have isolated the problem to be the Common Dialog Control itself (after selecting the file, I now do nothing but exit the form.) It is statically placed on the form.
I also attempted to instead dynamically add the Common Dialog Control to the form, use it, remove it from the form and set the object to nothing but had the same result.
Any idea how to get beyond this problem?
Private Sub cmdSave_Click()
Dim sFilePathAndName as String
On Error Goto cmdSave_Exit
.CancelError = True
.DefaultExt = ".txt"
.Filter = "Text File (*.txt)|*.txt"
.DialogTitle = "Save As"
.flags = cdlOFNExplorer + cdlOFNNoReadOnlyReturn + cdlOFNOverwritePrompt _
sFilePathAndName = .FileName
' trivial case to show problem
' just exit the form and leave the application running,
' then try to eject the removable media