Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Calling GetVolumeInformation() causes "Not Responding" in Vista

Back to Forum: Tech Off
  • User profile image
    lagouyn

    (Using Vista 5744)

    If I call GetVolumeInformation() from a dialog on an optical disc drive into which I have just inserted a disc, that dialog will show "Not Responding", which goes away after GetVolumeInformation() returns -- presumably after the disc has finished getting mounted.

    This problem does not occur on Windows XP.

    For example, if I add the following (sorry for the formatting) to the default VisualStudio C++ Win32 application's About box dialog proc, if I hit OK just after inserting the disc, the dialog will go to Not Responding. Note that if I don't interact with the dialog after clicking OK, this problem doesn't happen, but if I click the OK button again, or try to move the dialog, the problem happens.

    case WM_COMMAND:

    if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)

    {

    UINT uDrives = ::GetLogicalDrives();

    UINT uDriveIndex;

    wchar_t sRoot[4] = L"A:\\";

    for(uDriveIndex = 0; uDriveIndex < 26; uDriveIndex++)

    {

    if(uDrives & (1 << uDriveIndex))

    {

    sRoot[0] = 'A' + uDriveIndex;

    if(::GetDriveTypeW(sRoot) == DRIVE_CDROM)

    {

    wchar_t szVolumeName[MAX_PATH];

    GetVolumeInformationW(sRoot, szVolumeName, MAX_PATH, NULL, NULL, NULL, NULL, 0);

    }

    }

    }

    Ideas? I would think that a call to a synchronous Win32 function shouldn't cause the window/dialog title to show Not Responding while that function is executing.
     
    Regards,
    Allan

  • User profile image
    littleguru

    Does it completely crash? If not, Windows thinks the thing has crashed, because the messages to it aren't processed anymore for given time. This has nothing to do with your method call. If it's a real problem, you should try to create a new thread or use a delegate (asynch call) to invoke the method.

  • User profile image
    lagouyn

    Hi,

    It does not crash. After about eight-to-ten seconds (presumably, the time for the inserted disc to finish spinning up), we get control back. So the Not Responding message is temporary.

    Having to create a new thread or do something asynchronously here seems like overkill...I'm merely calling the Win32 api to get the volume information. The application shouldn't go to Not Responding. Vista should know that it is in the process of mounting the disc while it is servicing this api call on that disc, and it shouldn't cause the application to go to Not Responding.

    Regards,
    Allan

  • User profile image
    JChung2006

    Doing it asynchronously is not overkill.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.