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?
A:
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.
rpetrich
2009-05-26 00:14:57
By just reading we cant lock the tray... You can able to lock the cd tray.
Srinivasan__
2009-05-29 18:31:40
+1
A:
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..."
Peter M
2009-06-14 16:37:18
@ peter M Could you please give the exact function for lock and the same for unlock here.
Srinivasan__
2009-06-15 14:50:29
All I know is what is in the link that I have posted. I have never used this function myself.
Peter M
2009-06-16 12:33:51
A:
Please, try this sample is the best solution:
http://vbnet.mvps.org/index.html?code/disk/deviolock.htm
Regards
d3lph1f0cu5
d3lph1f0cu5
2010-09-18 07:19:31