News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

icon menu

Started by ragdog, June 17, 2008, 09:11:48 PM

Previous topic - Next topic

ragdog

hi

i have a another probelm with add a program icon to a  menu
have your a idea why this not work?

source is added

thanks in forward
ragdog



[attachment deleted by admin]

jj2007

Twice the same identifier?

            invoke     AppendMenu,hSMenu3,MF_BITMAP + MF_STRING,1000,offset szItem
            invoke     AppendMenu,hSMenu3,MF_BITMAP + MF_STRING,1000,offset szItem1

Note it would be easier if you were more specific, i.e. does it assemble, if not: error messages, if yes: what's the problem then, and especially: where in your dozen files do you believe should we find the problem.

ragdog

the problem is this draw not the icon in menu

thanks for your reply

ragdog

hi

i have add xxcontrols lib
this draw not my text and not the correct icon
have your a idea?


invoke     GetMenu,hWnd
              mov     hMenu,eax
             
          invoke      ImageList_Create, 16, 16, ILC_COLOR or ILC_MASK, 18,0
              mov     hImageList, eax

              mov     mii.cbSize, sizeof mii
              mov     mii.fMask, MIIM_DATA or MIIM_ID or MIIM_STATE or MIIM_SUBMENU or MIIM_TYPE or MIIM_CHECKMARKS
           INVOKE     CreatePopupMenu
              mov     hSMenu3, eax
              mov     mii.fType, MFT_STRING
             push     hSMenu3
              pop     mii.hSubMenu
              mov     eax, offset szNewMenu1
              mov     mii.dwTypeData, eax
           INVOKE     InsertMenuItem, hMenu, 8, TRUE, addr mii  ; Adds new menu
           INVOKE     DrawMenuBar, hWnd

           invoke     AppendMenu,hSMenu3,MF_STRING,1000,offset szItem
         
       ;get the icon of the item
           invoke     SHGetFileInfo, offset szProg, NULL, addr sfi, sizeof sfi,\
                  SHGFI_ICON or SHGFI_ICON+SHGFI_ICONLOCATION +SHGFI_USEFILEATTRIBUTES

    ;insert the icon into the image list
        invoke     ImageList_AddIcon, hImageList, sfi.hIcon

        invoke     ImageList_GetIcon, hImageList, 0, ILD_NORMAL

           invoke     SetMenuItemIcon, hSMenu3,1000,eax
           INVOKE     DrawMenuBar, hWnd


greets
ragdog

[attachment deleted by admin]

jj2007

invoke AppendMenu, hmenu, MF_STRING, id, addr MyString
invoke SetMenuItemBitmaps, hmenu, ... MF_BYCOMMAND or MF_BITMAP, Bitmaphandle, 0

BOOL SetMenuItemBitmaps(

    HMENU  hmenu,   // handle of menu
    UINT  uItem,   // menu item to receive new bitmaps
    UINT  fuFlags,   // menu item flags
    HBITMAP  hbmUnchecked,   // handle of unchecked bitmap
    HBITMAP  hbmChecked   // handle of checked bitmap

ragdog

hmm

i have add this

this does not work       :'(

invoke     ImageList_GetIcon, hImageList,1, ILD_NORMAL
invoke     SetMenuItemBitmaps, hSMenu3,1000,MF_BYCOMMAND or MF_BITMAP,eax,eax

jj2007

invoke     ImageList_GetIcon, hImageList,1, ILD_NORMAL

What do you get in eax?

ragdog

i get the icon from imagelist


SetMenuItemBitmaps, hSMenu3,1000,MF_BYCOMMAND or MF_BITMAP,hBitmapUnchecked,hBitmapChecked


jj2007


ragdog

no it works not

I do not know further :'(


jj2007

Quote from: ragdog on June 18, 2008, 04:05:55 PM
i get the icon from imagelist

I repeat my question: What do you get in eax? A handle, or zero? If "the icon" is zero for some reason, you will hardly succeed. Hint: run your code with Olly.

ragdog

sorry for my understanding

get in eax a handle the stored icon

ragdog

hi @all

I comming not further with my Problem  :'(

With add Icons to menuitem can your Help me please!!

I added xxControls library and convert the Icon to Bmp
This Draw not The iconĀ“s in the menu Why??



invoke     GetMenu,hWnd
  mov     hMenu,eax
             
INVOKE    GetSubMenu,eax,0
    mov    hSMenu3, eax
invoke    ImageList_Create, 16, 16, ILC_COLOR16 or ILC_MASK, 19,0
    mov    hImageList, eax

invoke     SHGetFileInfo, addr szProg, NULL, addr sfi, sizeof sfi,\
SHGFI_ICON or SHGFI_ICON+SHGFI_ICONLOCATION+SHGFI_USEFILEATTRIBUTES

invoke    IconToBmp ,sfi.hIcon,16
invoke    ImageList_AddMasked, hImageList, eax, iBmpMaskColor
invoke    DestroyIcon, sfi.hIcon

         
invoke    ImageList_GetIcon, hImageList,0, ILD_NORMAL
invoke    SetMenuItemIcon, hSMenu3,2005,eax

invoke    RedrawMenu, hWnd, hMenu,0




[attachment deleted by admin]

jj2007

Quote from: ragdog on June 18, 2008, 09:20:47 PM
get in eax a handle the stored icon

You are supposed to get a handle. However, I don't see any debugging code in your listing. How do you verify that eax is not zero?

ragdog

hi

eax if not zero i use this function for my drive list

i have add a ico button for test this function you can see my screenshot




greets
ragdog