Ever had to enumerate the supported media files under Windows for example for the filter-string for
GetOpenFileName
?
Here is a simple solution (using ATL for the registry access):
void EnumSupportedMediaFileTypes()
{
CRegKey key;
CString s;
DWORD dwLen;
DWORD dw = key.Open(HKEY_CLASSES_ROOT, _T("Media Type\\Extensions"), KEY_READ);
for(DWORD n = 0;dw == ERROR_SUCCESS; n++)
{
dwLen = 100;
dw = key.EnumKey(n, s.GetBuffer(dwLen), &dwLen);
s.ReleaseBuffer();
if (ERROR_SUCCESS == dw)
{
}
}
}
This might not include all supported types, but it is a good beginning... :)