Question : Extract icon from EXE/DLL

I need to extract the icon of an EXE or DLL to show it in a menu in my application.
I was able to do this for Windows XP with code from:
http://www.vbaccelerator.com/home/NET/Utilities/Icon_Extractor/article.asp

In Windows 7, I am getting one of two errors:
"Requested range extends past the end of the array"

or

"Insufficient memory to continue the execution of the program"

The apps I am trying to get the embedded icons from are:
NOTEPAD.exe
MSPAINT.EXE
CALC.EXE

Some other non-MS applications that I have tried seem to work fine.
dotnet applications that I have made don't work either

Questions :
1: Did MS change the way icons are stored in Windows 7?
2: Would there be any difference on 32-bit win7 or 64-bit win 7 for this process?
3. Why is this happening/how to resolve it?
4. How can I get the icon that is shown for an .EXE that was produced by vb.net?  I.e. the default icon that shows in Explorer for that .EXE?

Answer : Extract icon from EXE/DLL

Random Solutions  
 
programming4us programming4us