What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [PROBLEM] Icons in menu have black backgrounds on XP

[PROBLEM] Icons in menu have black backgrounds on XP
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. Huh?  [PROBLEM] Icons in menu have black backgrounds on XP
Hi,

I faced this problem already some time ago during Countdown Live 2 development, but I thought it was simply caused by my terrible coding. Maybe it is caused by it, but after so many revisions I think there has to be something else with this...

This is what my script does:
  1. I create a popup menu with CreatePopupMenu.
  2. I add a string menu item to it with AppendMenu.
  3. I create a HBITMAP from an image:
    1. I create a GDI+ Bitmap object from an image file (in my case, "test.gif") using GdipCreateBitmapFromFile.
    2. I create a HBITMAP from the Bitmap object using GdipCreateHBITMAPFromBitmap with 0xFF000000 0x00000000 as background parameter (totally transparent, according to Matty Matty made a mistake, PLSC updated).
  4. I add the HBITMAP to the menu item:
    1. I create a partial MENUITEMINFO structure with the cbSize, fMask and hbmpItem members set.
    2. I use SetMenuItemInfo to assign this structure to the menu item.
  5. I let the menu pop up when the user clicks on a button using TrackPopupMenu.
This works great! I can have beautiful icons next to my menu items, I even made a whole class which simplifies this process. I was so excited about this until... I sent it to my testers. First response: cool, but the menu item icons have a black background. The cause? I run Vista, my testers have XP. One of my testers also runs Vista and he confirmed that it works on his Vista PC, but not on his XP system.
I received this screenshot from one of my XP testers: (cropped)
[Image: menu-icon-problem.png]
I have spent hours trying to figure out why this was happening, but I couldn't find anything. Finally, I gave up and added a Windows version check so that the images would only be added on Vista or higher.

Since then, I periodically gave this problem another attempt to solve it, but today I decided to stop waisting time on it for much longer. I attached an example script of this problem, and if someone can find the missing link and fix this on XP... please, share your discoveries! :)

.plsc File Attachment: Menu Icon Problem.plsc (4.27 KB)
This file has been downloaded 164 time(s).

This post was edited on 01-04-2008 at 04:19 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-04-2008 04:04 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[PROBLEM] Icons in menu have black backgrounds on XP - by Matti on 01-04-2008 at 04:04 PM
RE: [PROBLEM] Icons in menu have black backgrounds on XP - by phalanxii on 01-05-2008 at 06:10 AM
RE: [PROBLEM] Icons in menu have black backgrounds on XP - by Matti on 01-05-2008 at 11:19 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On