Jump to content

Loading icons from a .exe file or .lnk


Recommended Posts

Guest spacemonkey
Posted

I'm writing a program that needs to list various files on the smartphone and display their icons. However I am a bit stuck on how to load the icon from the .exe files.

I use the following code, but when I check through the debugger nIcons is always 0 and hIcon, phiconLarge and phiconSmall are all NULL.

The file string is pointing to a valid file and has the form 'Storage CardProgram FilesC2Gapitest.exe' or what have you.

Any help would be most appreciated.

HICON phiconSmall;

HICON phiconLarge;

HICON hIcon

get_first_dir_element();

while (current_dir_element != NULL) {

 int nIcons = (int)ExtractIconEx(current_dir_element->fullpath, -1, NULL, NULL, 0);

 hIcon = ExtractIconEx(current_dir_element->fullpath, 1, &phiconLarge, &phiconSmall, 1);

 if (hIcon != NULL) {

 m_imageList.AddIcon(hIcon);

 DestroyIcon(hIcon);

 iconCur++;

 }

 get_next_dir_element();

}[/code]

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.