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

jj2007

I have tried to understand what you are doing, but it seems you are using a fairly exotic library. 38 Google hits for SetMenuItemIcon is not a good start ;-)

There is a working short example in C:\masm32\examples\exampl06\ecmenu\ecmenu.asm

ragdog

#16
thanks

i use the xxcontrols libraray

this example use only bitmaps i will use get the icons von anything app and add to my menu
this SetMenuItemBitmaps works not for me



SetMenuItemIcon proc h_Menu:HMENU, ItemID:DWORD, hIcon:HICON

   LOCAL mii      :MENUITEMINFOM
   
    mov mii.cbSize, sizeof (MENUITEMINFOM)
    mov mii.fMask, MIIM_DATA   
    m2m mii.dwItemData, hIcon
    invoke SetMenuItemInfo, h_Menu, ItemID, FALSE, ADDR mii

    ret
SetMenuItemIcon endp


i upload this xxcontrols libraray source

greets
ragdog

[attachment deleted by admin]

ragdog

hi guys

In my compiled exe works this not in my Plugin (.dll)
This draw not the MenuItem string why??



I use a Callback in my Dll for WM_COMMAND and WM_DRAWITEM ...



      push offset CallBackProc
      push GWL_WNDPROC
      push hWnd
        call SetWindowLong
       
      push eax
      push GWL_USERDATA
      push hWnd
        call SetWindowLong

CallBackProc proc hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL EditOldProc :DWORD
LOCAL hString [256]:DWORD
  invoke GetWindowLong,hWnd,GWL_USERDATA
  mov EditOldProc,eax
     
.if uMsg==WM_MEASUREITEM
  Invoke MeasureItem,lParam
  MOV EAX,TRUE
  RET
.ElseIf uMsg==WM_DRAWITEM
  Invoke DrawItem,lParam
  MOV EAX,TRUE
  RET
.elseif uMsg==WM_COMMAND
          mov     eax, wParam
     
         .if eax > 9000 && eax < 11000
                mov ebx,eax
             invoke GetMenuString,hMenu,ebx,addr hString,512,MF_BYCOMMAND
             invoke GetItemPath,addr hString
         .endif

     .endif
invoke CallWindowProc,EditOldProc,hWnd,uMsg,wParam,lParam
ret
CallBackProc endp





if I have add this GetMenuString under  MeasureItem Proc and DrawItem Proc then works this

MeasureItem Proc :
original:


MOV EDI, lParam
ASSUME EDI:PTR MEASUREITEMSTRUCT

Invoke lstrlen,[EDI].itemData
MOV ECX,EAX
Invoke GetTextExtentPoint32,hDC,[EDI].itemData,ECX,ADDR TextSize
MOV EAX,TextSize.x
MOV ECX,TextSize.y

modified:

MOV EDI, lParam
ASSUME EDI:PTR MEASUREITEMSTRUCT

    invoke GetMenuString,hMenu,[EDI].itemID,addr hString,512,MF_BYCOMMAND
Invoke lstrlen,addr hString
MOV ECX,EAX
Invoke GetTextExtentPoint32,hDC,addr hString,ECX,ADDR TextSize
MOV EAX,TextSize.x
MOV ECX,TextSize.y

DrawItem Proc:
original:


Invoke DrawText, [EDI].hdc,[EDI].itemData ,-1, ADDR [EDI].rcItem, DT_SINGLELINE or DT_NOCLIP or DT_VCENTER or DT_EXPANDTABS

modified:

invoke GetMenuString,hMenu,[EDI].itemID,addr hString,512,MF_BYCOMMAND
Invoke DrawText, [EDI].hdc,addr hString ,-1, ADDR [EDI].rcItem, DT_SINGLELINE or DT_NOCLIP or DT_VCENTER or DT_EXPANDTABS


Why works not [EDI].itemData for Itemstring?
Have your a anything idea?

Thanks in forward!