When debugging a C++ app that made trivial use of a ListView, the first click inside the ListView produced a noticeable delay before giving a visual feedback such as selecting an item or popping a menu. Debug output produced the following:
Loaded 'C:\WINDOWS\system32\winmm.dll' Loaded 'C:\WINDOWS\system32\wdmaud.drv' Loaded 'C:\WINDOWS\system32\setupapi.dll' Loaded 'C:\WINDOWS\system32\wintrust.dll' Loaded 'C:\WINDOWS\system32\crypt32.dll' Loaded 'C:\WINDOWS\system32\msasn1.dll' Loaded 'C:\WINDOWS\system32\imagehlp.dll' Unloaded 'C:\WINDOWS\system32\setupapi.dll' Unloaded 'C:\WINDOWS\system32\wdmaud.drv' Loaded 'C:\WINDOWS\system32\wdmaud.drv' Loaded 'C:\WINDOWS\system32\setupapi.dll' Unloaded 'C:\WINDOWS\system32\setupapi.dll' Loaded 'C:\WINDOWS\system32\msacm32.drv' Loaded 'C:\WINDOWS\system32\msacm32.dll' Loaded 'C:\WINDOWS\system32\midimap.dll'
To clarify, this happened with a standard Win32 ListCtrl, and the app did not make use of any sounds or multimedia APIs at all. Additionally, all system sounds were turned off in the Windows XP control panel. What was going on?
It turned out that a ListView is supposed to emit a sound upon item selection, and due to a bug that still shows up in Windows Vista, it even loads the necessary libraries when sounds are completely turned off at a system level.
The problem is easy to solve on an individual basis, but its not trivial to prevent it from occurring on other systems the app is run. All that needs to be done is delete this (empty) key in the current user’s registry hive:
It strikes me that such a bug, which is probably affecting a huge number of users, is not fixed. Whenever a ListView is clicked for the first time within an app, the DLL delayloading feature will steal a few milliseconds of the user’s time and induce a noticeable lag in UI reaction.
The following KB post describes this bug as Vista specific, although it can be reproduced on XP as well: