"Unsupported" (aka hack) solution (C/C++):
HWND hWnd = FindWindowW(L"Shell_TrayWnd", NULL);
if (hWnd != NULL)
PostMessageW(hWnd, WM_TIMER, 0x18, 0);
This will force the call of CoFreeUnusedLibraries function in the explorer process.
Tested on Windows 7 Ultimate SP1 64-bit and Windows XP Professional SP3 32-bit.
BTW, you can hit Windows+D (to minimize all windows) and wait for 3 minutes. The programmatic hack is based on this behaviour. It just calls the timer handler inside explorer process. And the handler code (C/C++) is:
KillTimer(hWnd, 0x18);
CoFreeUnusedLibraries();
There is no harm in calling of KillTimer function for non-existent timer.