Loading icons from other programs
I'm trying to make a file view which uses icons taken from the registry. In HKEY_CLASSES_ROOT most (all?) types have a DefaultIcon key on the format "XXX.dll, 2" or similar. My guess is that the first part is the exe/dll the icon lies in and the second is some kind of resource id.
Anyway, most of the times I'm unable to load the icon using the code below (sometimes it works but it's very rare). LoadLibrary succeeds but LoadIcon returns NULL. What am I doing wrong/missing?
Code:
HINSTANCE L = LoadLibrary("C:\\Program\\WinZip\\winzip32.exe");
HICON I = LoadIcon(L, MAKEINTRESOURCE(0));
(the DefaultIcon for zip-files are "C:\Program\WinZip\winzip32.exe, 0")
Footnote: Changing 0 to 1 makes it load a zip-icon...
EDIT: The error code is 1813 - "The specified resource type cannot be found in the image file." btw...