c – How to detect volume mount path changes on Windows?-ThrowExceptions

Exception or error:

I am working on a component in C to detect volume mount and unmount on Windows. When working with volume mounted on drive letters, everything works great by listening for WM_DEVICECHANGE with wparam set to DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE with dbch_devicetype set to DBT_DEVTYP_VOLUME in my top level window event handler.

However, when volumes are mounted on a directory path, I no longer receive WM_DEVICECHANGE event when mounting and unmounting on directory path.

Is there a way to listen for mount path changes?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *