Hi there,
Windows 10
I have created a right-click context menu (CreateMenu Win32 API) with 3 menu entries\items. The 3 menu items have all a light-grey background color but, when I point the mouse pointer over any of the menu items, the background of the menu item that is currently under the mouse becomes highlighted (becomes hot) and its color changes to light-blue.
If I change the machine theme colors via control panel, the highlight color is no longer light-blue. It changes to dark-grey.
I need to retrieve this highlight color regardless of the current color theme.
GetSysColor doesn't work with a themed user interface.
I have done some googling and found that one should use the uxtheme library for retrieving this menu highlight color, namely the OpenThemeData and GetThemeColor apis.
Questions:
1- OpenThemeData takes a hwnd. I don't know which hwnd I should pass to this api given the fact that the context menu is for an added system tray icon. Should I pass the hwnd of the application or that of the system tray, the menu handle or some other hwnd?
2- GetThemeColor takes two arguments (Parts and States)... I am not sure which ones I should use... Should I use (MENU, MENU_POPUPITEM,MENU_POPUPBACKGROUND .... MBI_HOT, MPI_HOT)... etc ?
Thanks in advance.
Windows 10
I have created a right-click context menu (CreateMenu Win32 API) with 3 menu entries\items. The 3 menu items have all a light-grey background color but, when I point the mouse pointer over any of the menu items, the background of the menu item that is currently under the mouse becomes highlighted (becomes hot) and its color changes to light-blue.
If I change the machine theme colors via control panel, the highlight color is no longer light-blue. It changes to dark-grey.
I need to retrieve this highlight color regardless of the current color theme.
GetSysColor doesn't work with a themed user interface.
I have done some googling and found that one should use the uxtheme library for retrieving this menu highlight color, namely the OpenThemeData and GetThemeColor apis.
Questions:
1- OpenThemeData takes a hwnd. I don't know which hwnd I should pass to this api given the fact that the context menu is for an added system tray icon. Should I pass the hwnd of the application or that of the system tray, the menu handle or some other hwnd?
2- GetThemeColor takes two arguments (Parts and States)... I am not sure which ones I should use... Should I use (MENU, MENU_POPUPITEM,MENU_POPUPBACKGROUND .... MBI_HOT, MPI_HOT)... etc ?
Thanks in advance.