CImageList: system image list and additional icon

Hello,

I need to create a CImageList with the system image list and an additional 
overlay icon. I read that the system image list retrieved using the 
SHGetFileInfo API must not be modified in any way, so how could I do that? I 
thought about somewhat duplicating the image list and then appending the 
icon (code below) but that does not seem to work. Any ideas? The code must 
run in any version of Windows. Thank you.


 SHFILEINFO sfi;
 HIMAGELIST hSystemImageList = (HIMAGELIST)SHGetFileInfo(_T("C:\\"), 0, 
&sfi,
   sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

 if (hSystemImageList != NULL)
 {
  // Possibly duplicate the system image list????
  CImageList SystemImageList;
  SystemImageList.Attach(hSystemImageList);
  m_ImageSmall.Create(&SystemImageList);
  SystemImageList.Detach();

  // Append an overlay image
  CImageList OverlayList;
  OverlayList.Create(IDB_SOMEICONS, 16, 0, RGB(255,0,255));

  HICON hIcon = OverlayList.ExtractIcon(1);

  if (hIcon != NULL)
  {
   int nCount = m_ImageSmall.GetImageCount();

   m_ImageSmall.Add(hIcon);
   m_ImageSmall.SetOverlayImage(nCount, 1);
  }

  SetImageList(&m_ImageSmall, LVSIL_SMALL);
 }


-- 
No�l
http://noeld.com/



0
noeld (15)
4/5/2006 4:57:12 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
1523 Views

Similar Articles

[PageSpeed] 9

http://www.codeproject.com/shell/overlayicon.asp

Tom

"No�l Danjou" <noeld@online.nospam> wrote in message 
news:%23xr6dINWGHA.3848@TK2MSFTNGP05.phx.gbl...
> Hello,
>
> I need to create a CImageList with the system image list and an additional 
> overlay icon. I read that the system image list retrieved using the 
> SHGetFileInfo API must not be modified in any way, so how could I do that? 
> I thought about somewhat duplicating the image list and then appending the 
> icon (code below) but that does not seem to work. Any ideas? The code must 
> run in any version of Windows. Thank you.
>
>
> SHFILEINFO sfi;
> HIMAGELIST hSystemImageList = (HIMAGELIST)SHGetFileInfo(_T("C:\\"), 0, 
> &sfi,
>   sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
>
> if (hSystemImageList != NULL)
> {
>  // Possibly duplicate the system image list????
>  CImageList SystemImageList;
>  SystemImageList.Attach(hSystemImageList);
>  m_ImageSmall.Create(&SystemImageList);
>  SystemImageList.Detach();
>
>  // Append an overlay image
>  CImageList OverlayList;
>  OverlayList.Create(IDB_SOMEICONS, 16, 0, RGB(255,0,255));
>
>  HICON hIcon = OverlayList.ExtractIcon(1);
>
>  if (hIcon != NULL)
>  {
>   int nCount = m_ImageSmall.GetImageCount();
>
>   m_ImageSmall.Add(hIcon);
>   m_ImageSmall.SetOverlayImage(nCount, 1);
>  }
>
>  SetImageList(&m_ImageSmall, LVSIL_SMALL);
> }
>
>
> -- 
> No�l
> http://noeld.com/
>
>
> 


0
tserface (3860)
4/5/2006 5:19:45 PM
Thanks Tom. Sorry I forgot to mention that I want to use the CImageList in 
my own application not in a shell extension.
-- 
No�l
http://noeld.com/ 


0
noeld (15)
4/5/2006 7:44:17 PM
You can still do that you just have to get the imagelist for the overlay 
images and add your own to it.  This only works in the list control because 
it does some magic with it internally.

Tom

"No�l Danjou" <noeld@online.nospam> wrote in message 
news:ubFvrlOWGHA.3440@TK2MSFTNGP02.phx.gbl...
> Thanks Tom. Sorry I forgot to mention that I want to use the CImageList in 
> my own application not in a shell extension.
> -- 
> No�l
> http://noeld.com/
> 


0
tserface (3860)
4/5/2006 9:16:50 PM
Thanks Tom, that seems to be a bit overkill to create and to register a 
component for my purpose. I am not sure yet how and why my CListCtrl-derived 
class would call this component to get the overlay image.

I had a simple working solution (see below) but I am just not sure whether 
this is valid/allowed and whether this alters the actual system image list 
or a copy:

 SHFILEINFO sfi;
 HIMAGELIST hSystemImageList = (HIMAGELIST)SHGetFileInfo(_T("C:\\"), 0, 
&sfi, sizeof(SHFILEINFO),
               SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

 if (hSystemImageList != NULL)
 {
  // m_ImageSmall.Detach() called in desctructor
  m_ImageSmall.Attach(hSystemImageList);

  // Append an overlay image
  CImageList OverlayList;
  OverlayList.Create(IDB_SOMEICONS, 16, 0, RGB(255,0,255));

  HICON hIcon = OverlayList.ExtractIcon(1);

  if (hIcon != NULL)
  {
   int nCount = m_ImageSmall.GetImageCount();

   m_ImageSmall.Add(hIcon);
   m_ImageSmall.SetOverlayImage(nCount, 1);
  }

  SetImageList(&m_ImageSmall, LVSIL_SMALL);
 }


-- 
No�l
http://noeld.com/ 


0
noeld (15)
4/6/2006 4:46:11 PM
That should be working just for that list control. I thought you wanted your 
icon to show up in Explorer... sorry.

Tom

"No�l Danjou" <noeld@online.nospam> wrote in message 
news:eEdZtmZWGHA.196@TK2MSFTNGP04.phx.gbl...
> Thanks Tom, that seems to be a bit overkill to create and to register a 
> component for my purpose. I am not sure yet how and why my 
> CListCtrl-derived class would call this component to get the overlay 
> image.
>
> I had a simple working solution (see below) but I am just not sure whether 
> this is valid/allowed and whether this alters the actual system image list 
> or a copy:
>
> SHFILEINFO sfi;
> HIMAGELIST hSystemImageList = (HIMAGELIST)SHGetFileInfo(_T("C:\\"), 0, 
> &sfi, sizeof(SHFILEINFO),
>               SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
>
> if (hSystemImageList != NULL)
> {
>  // m_ImageSmall.Detach() called in desctructor
>  m_ImageSmall.Attach(hSystemImageList);
>
>  // Append an overlay image
>  CImageList OverlayList;
>  OverlayList.Create(IDB_SOMEICONS, 16, 0, RGB(255,0,255));
>
>  HICON hIcon = OverlayList.ExtractIcon(1);
>
>  if (hIcon != NULL)
>  {
>   int nCount = m_ImageSmall.GetImageCount();
>
>   m_ImageSmall.Add(hIcon);
>   m_ImageSmall.SetOverlayImage(nCount, 1);
>  }
>
>  SetImageList(&m_ImageSmall, LVSIL_SMALL);
> }


0
tserface (3860)
4/6/2006 4:52:50 PM
Reply:

Similar Artilces:

Room booking system using a Gantt chart
Hi, I am trying to set up a room booking system using a Gantt chart approach. I am working on a working example that I downloaded from John Lacher's site (http://lacher.com/examples/lacher24.htm), which almost meets my needs. His example display a room booking system over a 24 hour period. What I need it to do it to show a room booking system over a weekly/monthly period, etc. I have tinkered around with it endlessly but cannot get anywhere. Everytime I format the y axis to date format the chart goes ski-wift - after 6 hours it's starting to drive me bananas! Could someon...

Restore mailboxes after system rebuild
I recently had my SBS2003 server crash which required the entire operating system to be reinstalled. I have a complete backup of the system and a backup of Exchange before the crash. I've kept the userids the same on the system. How do I recover these users old email files and merge them into their existing email files? Thanks, -- Gyro ...

Faulty distribution list in outlook express
A distribution list that was working a few weeks ago is not working properly now. OE says the message is sent and it appears in the ''Sent@ folder but no-one recieves it. Why? Graham;116885 Wrote: > A distribution list that was working a few weeks ago is not working > properly > now. OE says the message is sent and it appears in the ''Sent@ folder > but > no-one recieves it. Why? This forum is for questions bout Office Outlook, not Outlook Express. Ask in an appropriate forum, like microsoft.public.outlookexpress.general -- Brian Tillma...

System Hangs
I have a couple of systems (W98SE) that are running the Office 2000 Products. Anytime they try to open EXCEL their system hangs and the only way out is a Hard Boot (power off). It only happens with the EXCEL program. These systems were able to open and use EXCEL, then all of a sudden System Hangs. Thank you for your assistance. Chip Pearson has some notes to help diagnose startup problems at: http://www.cpearson.com/excel/StartupErrors.htm A couple of guesses. 1. Clean up the windows temp folder. (then test it out) 2. sometimes the file that holds the customized toolbar settings ge...

Automatically update a 2 lists
I have two identical lists in 2 separate speadsheets. How can I automatically update both lists by only entering new data into one os the lists. Allan Check out help on "linking" or "links". Note: you can only go one way using links. i.e. you cannot link sheet1 to sheet2 and sheet2 to sheet1 using same cells. Gord Dibben Excel MVP On Tue, 15 Nov 2005 05:14:31 -0800, "Allan" <Allan@discussions.microsoft.com> wrote: >I have two identical lists in 2 separate speadsheets. >How can I automatically update both lists by only entering new data into ...

Strange Distribution list problem
Hello, One of the users at my work has a strange problem with one of their distribution lists. When he sends a mail to that list, he gets a reply saying that it's undeliverable and the reason was that there was "no transport provider available". He gets this reply for all 15 people on his distribution list. When he sends to them individually however, it all works fine. I've checked the emails they are all just standard addresses, our email server is working fine, because he can send other mail. He even has 4 other distribution lists similiar to this problematic on...

Using one source list for two depends drop-down list
I am trying to use the same drop-down source list for two depends drop-down depends lists. Any idea?? Thx. I'm not sure that that is what you are after by I would suggest to take a look at this: http://www.contextures.com/xlDataVal02.html http://www.contextures.com/xlDataVal13.html Micky "Grand Seigneur" wrote: > I am trying to use the same drop-down source list for two depends drop-down > depends lists. Any idea?? Thx. Thanks, that helped me! "מיכאל (מיקי) אבידן" wrote: > I'm not sure that that is what you are after by I would su...

get list of used namespaces
Hi all, I load an xml file into XmlDocument object and would like to get a list of namespaces used in the file. How can I get a list of namespaces used in xml file? Thanks. helpful sql wrote: > I load an xml file into XmlDocument object and would like to get a list > of namespaces used in the file. How can I get a list of namespaces used in > xml file? XPath has a namespace axis for namespace nodes which are in scope for a given element node, here is an example using an XPath expression with SelectNodes to output all namespace nodes (those explictly given and th...

Saving a scrollable image in bitmap and jpeg format
I have a picture control in which i am diaplaying images of various sizes if size go beyond the size of the dialog then scrollbars becomes active so view the hidden image. But when wriiten two functions to save that bitmap following problems occured: 1> For the first function it was saving only viewable area of teh bitmap 2> for second if i have specified the dimensions as 800 X 600 and picture control diamensions is 345 X 330 then it is taking area outside dialog to get image of the 800 X 600 How can i save the image with same dimensions with which i am displaying it ? Thanking in ant...

Reminder list view
Is there a way to change the view for reminders in Outlook XP. Our new XP users are asking for reminders to pop-up individually like in Outlook98, not as a list in one window. Registry hacks are welcome. Nope. -- Patricia Cardoza Outlook MVP Author - Special Edition Using Microsoft Office Outlook 2003 Lead Author - Access 2003 VBA Programmer's Reference Author - Absolute Beginner's Guide to Microsoft OneNote 2003 http://blogs.officezealot.com/cardoza http://www.cardozasolutions.com "London Canada" <London Canada@discussions.microsoft.com> wrote in message news:1...

System notification in order entry
I would like to see a system notification if a sales order is being entered for a specfic customer and the purchase order already exists on another order for that same customer ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/...

"Unpivot Technique"
I am trying to reorganize a table into a list and have used the "unpivot' technique described by John Walkenbach: http://j-walk.com/ss/excel/usertips/tip068.htm However, there is a problem because the created list is huge so will not fit in the worksheet (not enough rows). It will fit in if blanks are ignored. Is there a way that I can get the blanks to be ignored? -- frankybenali ------------------------------------------------------------------------ frankybenali's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=18707 View this thread: http://www.ex...

Exchange Contacts list
I maintain the contact info for my old Air Force Pilot Training group. I would like to send that info to a couple other pilots so they can have a backup listing. They use Outlook also. What would be the best way to do that? I've tried going into Contacts and choosing import/export but the export options don't include the basic format that Outlook uses. Mail merge seems to be for sending mass mailings. There may be an easier way than this, but . . . Create a PST file (if using 2007, make sure the PST file is 2000 compatible), Copy the contacts folder to the PST file, Emai...

Is CRM a good tool for marketing list management?
In conversation, the question came up on whether or not CRM is a good tool for marketing list management. One of the main concerns is that the by loading hundreds of accounts and thousands of contacts into the database, performance will degrade. (Currently we have about 360 companies and about 800 contacts.) -- Med On May 23, 3:39 pm, Medardo Lacayo <MedardoLac...@discussions.microsoft.com> wrote: > In conversation, the question came up on whether or not CRM is a good tool > for marketing list management. One of the main concerns is that the by > loading hundreds of ac...

Print Global Address List
Is there a way in Exchange 2000 or Outlook 2003 that I can print the Global Address List? Thanks Try the "IMI GAL Exporter" from http://www.imibo.com/imidev/Exchange/imige.htm "HELPME" <HELPME@discussions.microsoft.com> wrote in message news:3E99878D-3AE5-48CA-A55D-AAE214475CB0@microsoft.com... > Is there a way in Exchange 2000 or Outlook 2003 that I can print the > Global > Address List? > > Thanks ...

Detect system Idle (NOT just 'no user input')
How do I detect if the system is idle or how much it has been idle in the last say 20ms for example. This is similar to the idle time display in 'WinTop' or other process monitoring programs. My goal is to determine if all apps that may have needed to do a paint have finished their painting. Thanks, Harvey OnIdle() PeekMessage "Harvey" <harveyab@juno.com> ??????:1175147532.713355.47540@y80g2000hsf.googlegroups.com... > How do I detect if the system is idle or how much it has been idle in > the last say 20ms for example. This is similar to the idle time > di...

System Data Protection 2007 on a SBS 2008 Domain
Hi all, This is a lab situation where I have SBS 2008 running on HyperV and doing well... I would like to install Server 2008R2, give it 2 or 4 GBs RAM, 2 CPUs and then install System Data Protection 2007 Has anyone tried this? Is it doable at all? Thanks to all, Dan On Jan 7, 11:52=A0am, "Daniel Jewel" <cyberdud...@yahoo.com.br> wrote: > Hi all, > > This is a lab situation where I have SBS 2008 running on HyperV and doing > well... > > I would like to install Server 2008R2, give it 2 or 4 GBs RAM, 2 CPUs and > then install Sy...

server system drive rights
Hi, What are the default NTFS rights on the C system drive on a windows 2003 server? I have IIS and sharepoint installed. Thank you, T Should be real similar. http://support.microsoft.com/kb/244600 -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Tester" wrote: > Hi, > What are the default NTFS rights on the C system drive on a windows > 2003 server? I have IIS and sharepoint installed. > Thank you, T ...

Listing Entities and Attributes from a XML Schema
Hi all.. ..NET + MSXML platform....VB Need to build a list of all the entities and attributes to allow the user to do search...how can i do that from the schema ?? Cheers Rohit Rohit Sharma wrote: > .NET + MSXML platform....VB Are you sure you are using MSXML? Actually .NET doesn't include MSXML in any form. > Need to build a list of all the entities and attributes to allow the user to > do search...how can i do that from the schema ?? Could you provide some sample of what are you looking for? It's not clear, whether you need all attributes in schema file or all attr...

Making a Scalable Image on a DialogBox Options ???
Does anyone know how to make a scalable image on a DialogBox? I am currently using a static Picture Control, can this be adapted to become scalable to the size of the DialogBox? Maybe one of these will help you out: http://www.codeproject.com/bitmap/picturewindow.asp?df=100&forumid=163&exp=0&select=130606 http://www.codeproject.com/dialog/bmpdlg01.asp?df=100&forumid=4056&exp=0&select=312699 Tom "PeteOlcott" <PeteOlcott@gmail.com> wrote in message news:1186681167.452953.316290@i13g2000prf.googlegroups.com... > Does anyone know how to make a scala...

How do I publish a workbook with a list?
When I publish it I get the error message: For type list the absence of a <cellrangelist> tag implies the relative cell references in the list which is not allowed. The workbook is protected but has areas that are unlocked for editing by users. This function (editing of cells) is not working, not only for cells connected to the list but also for cells with no list attached. ...

referencing images in Excel 2007
I have a todo list for genealogy searches. One of the columns is for results. Some of the results are images or documents. What is the best way to do this in the Excel "results" column? If I paste the image, it is not linked to a specific cell and is anyway too large and therefore messes up the Excel spreadsheet row alignements. Suggestions? Thanks. Jeff If the image lies completely within the confines of the cell boundaries it will sort with the rows. Size your images accordingly and embed as an Icon in the cell. A double-click on the Icon will open the image in your favori...

System Control Snapin with SP2
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C683D1.72861070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I was trying to setup some of the features that came with SP2, = specifically IMF and am not seeing all of the options available. I know = I installed sp2 on the exchange server, but I was wondering if there was = a new management console I had to install as well, or did I just install = incorrectly.=20 --=20 NATHAN WELDON ------=_NextPart_000_0006_01C683D1.72861070 Content-Type: text/html; charset=&qu...

Change Price List Item Amount
Is it possible to change the Price List Item Amount? We only get the information in the preview pane, but we can't update it. Thank's ...

create list of e-mail addresses from distribution lists
I need to take "Global Address" Distribution Lists and convert them into invidiual e-mail addresses to use for an e-vite. Is there an easy way to do this? "Wanda" <Wanda@discussions.microsoft.com> wrote in message news:E48C11C3-20F8-4B79-8E56-E08FCA13F8A2@microsoft.com... >I need to take "Global Address" Distribution Lists and convert them into > invidiual e-mail addresses to use for an e-vite. Is there an easy way to do > this? Why? Why not send your "e-vite" (whatever that is) to the DL? -- Brian Tillman [MVP-Outloo...