cd insert/removal events

S

sanjana

hi
i m trying to detect CD insert removal events via the system.management

n i m using in the query 'Win32_LogicalDisk'


When i try to access the property of these class like Size ..
it give me THE USED SPAce in the cd


doubt:
however when i try to access the property of these class like
MaxMediaSize ..
it give me an error "NOT fOUND" y????????????


when i try to access the property of these class like FreeSpace..
it always gives me the value as 0 y????????????????


here is the part of the code
ManagementObject mo = new
ManagementObject("Win32_Logica­lDisk.DeviceId='D:'");


mo.Get();


UInt64 ulngFreeSpace = (UInt64) mo["FreeSpace"];
UInt64 ulngmediaSpace = (UInt64) mo["MaxMediaSize"];

i wanto get the free space in the cd how do i get tht?????????????
thanx
 
J

Johann Blake

My guess is that, like Explorer, a CD does not return any space
available.

Best Regards
Johann Blake
 
W

Willy Denoyette [MVP]

CD and DVD's don't report freespace, they only report the space used (size
property).
The free space can only be guessed depending on the media type loaded (CD,
DVD etc...) but none of them have fixed maximum space properties, so it's
only a guess.

Willy.



hi
i m trying to detect CD insert removal events via the system.management

n i m using in the query 'Win32_LogicalDisk'


When i try to access the property of these class like Size ..
it give me THE USED SPAce in the cd


doubt:
however when i try to access the property of these class like
MaxMediaSize ..
it give me an error "NOT fOUND" y????????????


when i try to access the property of these class like FreeSpace..
it always gives me the value as 0 y????????????????


here is the part of the code
ManagementObject mo = new
ManagementObject("Win32_Logica­lDisk.DeviceId='D:'");


mo.Get();


UInt64 ulngFreeSpace = (UInt64) mo["FreeSpace"];
UInt64 ulngmediaSpace = (UInt64) mo["MaxMediaSize"];

i wanto get the free space in the cd how do i get tht?????????????
thanx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top