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?

Was it helpful?

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top