?
Solved

Load icon from other file (Win32/VC++)

Posted on 2004-09-03
3
Medium Priority
?
1,361 Views
Last Modified: 2008-01-09
Hello,

I have code that uses:

============
IShellLink::GetIconLocation Method

Retrieves the location (path and index) of the icon for a Shell link object.

Syntax

HRESULT GetIconLocation(          LPTSTR pszIconPath,
    int cchIconPath,
    int *piIcon
);
============

to get information about the icon associated with a windows shortcut.  Given the path, and the piIcon identifier, what function is it that actually loads the icon so my program can use it?

Thanks.
0
Comment
Question by:helpmealot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 11978667
You'd use 'LoadIcon()', e.g.

char acIconPath [ MAX_PATH];
int nIdx = 0;
pMyShellLink->GetIconLocation  ( acIconPath, MAX_PATH, &nIdx);

HINSTANCE hMod = LoadLibrary ( acIconPath);
HICON hIcon = LoadIcon ( hMod, nIdx);

//...
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11980619
You can use IExtractIcon::Extract Method

HICON hLarge,hSmall;
...
Extract(szIconLoc, iIndex, &hLarge, &hSmall, 16);
0
 

Author Comment

by:helpmealot
ID: 11985076
Thanks for the tips everyone, jkr's solution is what I had in mind.  It does just what I needed.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question