Hi,
Well first of all - what is the value of err after attempting to eject the disk??
Second of all, have you tried to display the text-message of this error code? I see no call to FormatMessage anywhere in your code.
If you haven't, and are not familiar with the method to do so, you may wish to pay particular attention to the use of GetLastError and FormatMessage in
this [
^]link.
Hope this helps.