hi i have a little problem with this routine
error A2098: invalid operand for OFFSET
hButtonID[esi] has the button id's from .ini file , example 9000-9010.
how i can add this id's to the menu
LOCAL hButtonID[256]:BYTE
xor esi, esi
.while (byte ptr hButtonID[esi] != 0)
invoke GetPrivateProfileString, addr szToolbars, addr hButtonID[esi], 0,\
addr hToolName, 256, addr szIniFile
lea edx, hToolName
xor edi, edi
push eax
.while (eax)
.if byte ptr[edx+edi] == ','
mov byte ptr[edx+edi], 0
.break
.endif
inc edi
dec eax
.endw
mov mii.fType, MFT_STRING
mov eax,offset hButtonID[esi] ;<<<<<<<<<<<<<<<< hButtonID[esi] has the new ids
mov mii.wID,eax
mov mii.hSubMenu, 0
mov eax,offset hToolName
mov mii.dwTypeData,eax
INVOKE InsertMenuItem, hSMenu3, 0, TRUE, addr mii ; Adds to the end
INVOKE DrawMenuBar, hWnd
add esi, 9
.endw
thanks in forward
The problem is that hButtonId lives on the stack, so it's address isn't known at assembly time.
Use lea eax,hButtonID[esi] instead.
thanks for your help
This works not correct :(
I want to id's for the menu button of the ini file
my ini
[too]
9001=string1
9002=string2
9003=string3
lea ebx,hButtonID[esi]
mov mii.wID, 9001
mov mii.hSubMenu, 0
mov eax, offset hToolName
mov mii.dwTypeData, eax
have an idea
opps. Sorry, I misread what you were doing.
so you want the VALUE at hButtonID(esi). Just use it.
mov eax,dword ptr hButtonID[esi]
or did I misunderstand again?
hmm works not
have you an another idea?
Okay, one more try.
MENUITEMINFOA.wID expects a 32 bit integer value.
hButtionID contains the string representation of the values.
so you have to convert from string to integer first, then put the value in .wID
eg.
invoke atol,addr hSubMenu(esi) ; don't forget to save ecx and edx if needed
mov mmi.wID,eax
nice is perfect :U
thanks you
hi
i have a another problem with my menu
the first menu entry does not work the 2 and 3 works not corectly
and the menu id´s move´s to a on entry further ::)
no idea why
can your help me please?
I don't know why you were subtracting 5, I would have added 6.
lea ebx, hButtonID[esi]
; sub ebx,5
add ebx,6
invoke atol, ebx
:bg super
total simply mistake!!!
thanks for your works and help
greets
ragdog