Reputation: 801
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?
Upvotes: 0
Views: 1285
Reputation: 1655
This will not be of great use to you, but simple proof if can be done there, from linux kernel 2.6 documentation.
An alternative to API, meanwhile, could be this, a software that does just that, lock/unlock CD drives.
Cheers.
Upvotes: 0
Reputation: 7513
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..."
Upvotes: 1
Reputation: 32346
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.
Upvotes: 0