Locking removable drive?
Question
Friends, How to lock/unlock(software based) removable disk/drives in VB6? I need to know any specific win32 routines are there for this purpose?
Solution
Not having used this, I would say that you want to look at the win32 IOCTL_STORAGE_MEDIA_REMOVAL Control Code parameter to DeviceIoControl() which "..Enables or disables the mechanism that ejects media, for those devices possessing that locking capability..."
OTHER TIPS
Opening a file on the removable disk is the simplest way to lock the drive. This can be done with VB6's internal Open
command, or by declaring the OpenFile
API and calling that.
I imagine there are ways of locking the drive itself, but it is much easier to lock a file instead.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow