1

How can I change the application icon on mouseover? I want to put some menu items in the system menu of my CDialog, and I want the icon to highlight when the user mouses over it to indicate that it is a user interface component (similar to how recent versions of firefox have the firefox menu in orange and when you mouseover it, it highlights).

UPDATE

By "application icon" I mean the system menu icon. Also I just came across the CMFCRibbonApplicationButton class which, while not the system menu, also looks promising.

User
  • 62,498
  • 72
  • 186
  • 247
  • Define `application icon`. Application is an invisible thing, visible stuff includes windows, appbar, system tray icon etc. – Roman R. Oct 05 '11 at 14:37
  • Do you mean the Icon in the system menu, or an icon on a control that is embedded in the dialog? If the latter, have a look at this class: http://irms.cvs.sourceforge.net/viewvc/irms/IRMS/Controls/PicButton.cpp?revision=1.3&view=markup Caveat: This is code I wrote over 8 years ago, and I have not really looked at it since. But it was a CButton that had a bitmap resource that would change on mouse up/down events. Should be similar to what you need. – Chad Oct 05 '11 at 14:50
  • I mean the icon in the system menu. Updating question now. – User Oct 05 '11 at 15:18

2 Answers2

1

Check WM_NCHITTEST for HTSYSMENU code and then call SetIcon.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
l33t
  • 18,692
  • 16
  • 103
  • 180
  • Good one. +1. Correcting the spelling of `HTSYSMENU` now ;) ... although, does that work for the icon specifically (i.e. not the system menu, but hovering over the icon as asked). – 0xC0000022L Nov 25 '11 at 15:33
0

There is the code to implement MouseOverEvent: http://www.codeproject.com/KB/cpp/mouseenterleave.aspx When you catch the event you can do whatever you like.

Sunscreen
  • 3,452
  • 8
  • 34
  • 40