Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh removable medium

Status
Not open for further replies.

hennep

Programmer
Dec 10, 2000
429
I found that the findfirst, findnext functions do not detect media changes in removable drives.
Can somebody tell how to force a refresh in c/c++ of these drives when a medium has changed.

thanks,
Hennie
 
I've seen examples using a combination of GetLogicalDriveStrings, GetDriveInfo, GetDriveType, and GetVolumeInformation. You use the GetLogicalDriveStrings, GetDriveInfo, and GetDriveType API's to supply variables to GetVolumeInformation. If GetVolumeInformation fails then the drive is not ready otherwise you can get the drive info. James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
thanks James,

I can use GetDriveType to figure out if I have a removable medium, but how to do the actual refresh.
The information I have about these API's only give me a brief description of the function arguments, no example code

Hennie Peters
 
I'll have to try and find my examples. I suppose you could create a thread the would check the drive every so often.
James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
The problem is that my program shows the same files even if the disk is changed. The filenames that are found by the findfirst and findnext function are cached in memory.
Scanning files in a separate thread will not solve that problem, it will still show the information of the previous disk.

Hennie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top