Click to See Complete Forum and Search --> : Menu Image...


Devil Panther
August 4th, 2005, 05:18 PM
Is there a way to place an image on the right side of menu bar, without owner draw the entire menu?

I was thinking about maybe getting the window handle of the menu bar but I my sure it's possible since it comes before the client area, any idea?


Thank you.

NoHero
August 5th, 2005, 01:54 AM
SetMenuItemBitmaps() (http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/menus/menureference/menufunctions/setmenuitembitmaps.asp)

Devil Panther
August 5th, 2005, 04:57 AM
here is what I have so far, and it works well as a side image of a menuitem, but I want to place the image at the far right side of menu bar.


HBITMAP hBmp_logo = LoadBitmap(ghInstance, MAKEINTRESOURCE(IDD_ABOUT_DONATE));

SetMenuItemBitmaps(GetMenu(hwnd), 100, MF_BYPOSITION, hBmp_logo, hBmp_logo);


If I under the msdn correctly, if I use the MF_BYPOSITION flag the uPosition is a zero based postion of the bitmap on the menu bar...



BOOL SetMenuItemBitmaps(

HMENU hMenu,
UINT uPosition,
UINT uFlags,
HBITMAP hBitmapUnchecked,
HBITMAP hBitmapChecked
);Parameters

hMenu
[in] Handle to the menu containing the item to receive new check-mark bitmaps.
uPosition
[in] Specifies the menu item to be changed, as determined by the uFlags parameter.
uFlags
[in] Specifies how the uPosition parameter is interpreted. The uFlags parameter must be one of the following values.

MF_BYCOMMAND
Indicates that uPosition gives the identifier of the menu item. If neither MF_BYCOMMAND nor MF_BYPOSITION is specified,
MF_BYCOMMAND is the default flag.
MF_BYPOSITION
Indicates that uPosition gives the zero-based relative position of the menu item.

hBitmapUnchecked
[in] Handle to the bitmap displayed when the menu item is not selected.
hBitmapChecked
[in] Handle to the bitmap displayed when the menu item is selected.

NoHero
August 5th, 2005, 07:31 AM
This is only for items not for submenus...

HBITMAP hBmp_logo = LoadBitmap(ghInstance, MAKEINTRESOURCE(IDD_ABOUT_DONATE));
HMENU hMenu = NULL, hSubMenu = NULL;

hMenu = GetMenu(hwnd);
hSubMenu = GetSubMenu(hMenu, 1); // Zero based your submenu

SetMenuItemBitmaps(hSubMenu, 1, MF_BYPOSITION, hBmp_logo, hBmp_logo);

It will work when your menu looks this way:

File // GetSubMenu(hMenu, 0);
> Close
Help // GetSubMenu(hMenu, 1);
> About // MF_BYPOSITION #0
> Donate // MF_BYPOSITION #1

Devil Panther
August 5th, 2005, 08:09 AM
Well i did something alittle different:


hBmp_logo = LoadBitmap(ghInstance, MAKEINTRESOURCE(ID_BMP_LOGO));

AppendMenu(hMenu, MF_BITMAP, NULL, hBmp_logo);


that gave me this:
FILE VIEW HELP myimage

but I want now the ability to move 'myimage' whereever i please, like a position control over a floating image... if possible.FILE VIEW HELP myimage