What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Transparent bitmap in a pop-up menu

[?] Transparent bitmap in a pop-up menu
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
O.P. [?] Transparent bitmap in a pop-up menu
Okay, looking for some expert help here!

I have a right-click pop-up menu with some nifty features, but now I want to make it even nicer by placing images in front of the items. I can do this by loading a bitmap using LoadBitmap() and then use SetMenuItemBitmap() to set the bitmaps to the menu item. No problem at all to do this, the only problem is that the bitmaps aren't transparent. I know it has to be possible (how do the others do it else?) but I'm afraid my skills are just a tiny bit too less to do this. I guess I'll need to use GDI for this to make a certain color (like violet #FF00FF) transparent in the bitmap, so if anyone can help me with this, I'd really appreciate it! :)

This is what I use to place the bitmaps in the menu item at the moment:
code:
var hBitmapSrc = LoadBitmap(/* Path to file here */, 16, 16);
var MF_BYPOSITION = 0x400;
var Result = Interop.Call("user32", "SetMenuItemBitmaps", hMenu, i, MF_BYPOSITION, hBitmapSrc, hBitmapSrc); /* hMenu is the pop-up menu handle, i is the null-based item position */

function LoadBitmap(sPath, nWidth, nHeight) {
    var IMAGE_BITMAP = 0;
    var LR_LOADFROMFILE = 0x10;
    var LR_SHARED = 0x8000;
    var hInst = Interop.Call('kernel32', 'GetCurrentProcess');
    var hImage = Interop.Call('user32', 'LoadImageW', hInst, sPath, IMAGE_BITMAP, nWidth, nHeight, LR_LOADFROMFILE | LR_SHARED);
    return hImage;
}
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-21-2007 07:14 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] Transparent bitmap in a pop-up menu - by Matti on 08-21-2007 at 07:14 PM
RE: [?] Transparent bitmap in a pop-up menu - by matty on 08-21-2007 at 07:22 PM
RE: [?] Transparent bitmap in a pop-up menu - by Matti on 08-22-2007 at 10:42 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