-2

First of all,i have gotten the value of iImage member of TBBUTTONINFO structure.

Next,i wanna extract the icon on system tray through the iImage member of TBBUTTONINFO structure with C++ api under win7 32bit?

Is it possible and if it is,what should i do?

Thank you!

digger
  • 55
  • 2
  • 5
  • 1
    This is not supported. If you are desperate, why not reverse engineer it yourself? Do be warned that because you are using unsupported means, your code is subject to breaking in future (or past) releases. – David Heffernan Feb 09 '17 at 13:19
  • I don't understand. What has `TBBUTTONINFO` (which is information about a single button on a toolbar), got to do with the icon shown in the taskbar notification area? (If you call it the system tray, you risk [the wrath of Raymond Chen](https://blogs.msdn.microsoft.com/oldnewthing/20030910-00/?p=42583). – Martin Bonner supports Monica Feb 09 '17 at 13:24
  • thank you for your link@Martin Bonner ,i am in the wrong direction,please give me some suggestion for my question.what shall i do now? – digger Feb 09 '17 at 13:43
  • There is no supported API to do this. Why do you feel the need to extract notification icons? – David Heffernan Feb 09 '17 at 13:50
  • Thank you @David Heffernan. It is needed in my project.If so,i find other ways to do it only.As i know,someone had made it come true.in API. – digger Feb 09 '17 at 14:02
  • Whatever. You are going to ignore advice and continue trying to do what you aren't supposed to do. – David Heffernan Feb 09 '17 at 14:53
  • @MartinBonner the notification area is a standard toolbar control; its image list is the notification icons. This is an implementation detail, of course, but it has held true for more than a decade, so... – andlabs Feb 09 '17 at 17:01

1 Answers1

1

Assuming you have already injected yourself into the Explorer process you can send TB_GETIMAGELIST to the toolbar and then call ImageList_GetIcon or ImageList_GetImageInfo.

If on the other hand you have not injected into the process but are using VirtualAllocEx and ReadProcessMemory to get the toolbar info then you will have problems because you cannot easily copy GDI objects from one process to another.

This old application called TraySaver might be able to give you some help but what you are doing is not supported and can break at any point because the classname of the tray icon window and the taskbar window hierarchy is undocumented and you are not supposed to access it this way.

Anders
  • 97,548
  • 12
  • 110
  • 164
  • thank you @Anders.You let me know what i should do next. – digger Feb 09 '17 at 14:37
  • 2
    What you should do next is to give up. If you have injected into Explorer then you can code defensively and hope your code does not break in the future. – Anders Feb 09 '17 at 15:17