when i read the code ,i find it different to understand ,can someone give me an explanation

and just some code to replace this?

.elseif uMsg == WM_MEASUREITEM
.if wParam == 0

mov edi, lParam
assume edi:ptr MEASUREITEMSTRUCT ;???????????
mov .itemWidth, 150 ;???????????

.if .itemID == 0
mov .itemHeight, 3
.else
mov .itemHeight, 24
.endif

assume edi:nothing

.endif

mov eax,1
ret
Posted on 2004-08-01 03:34:25 by bailao
assume edi:ptr MEASUREITEMSTRUCT means that address edi is a pointer to a
MEASUREITEMSTRUCT structure

mov .itemWidth, 150 means one loads 150 into itemWidth....

assume edi:nothing means or indicate the end of ths pointer....


MEASUREITEMSTRUCT Struct

.......
itemWith dd ?
.......

MEASUREITEMSTRUCT ends




Gerard...
----
Posted on 2004-08-01 03:51:34 by gerard
-Deleted- ;x
Posted on 2004-08-01 03:54:39 by HeXeN
Hi bailao

Lets say we have the following structure in our program.


POINT struct
x dd ?
y dd ?
POINT ends

Lets say we create a POINT variable in the data segment.
Since the variable is statically defined we can access the structure members directly by using the variable name


.data
pnt POINT <>

.code
mov pnt.x, 1
mov pnt.y, eax

Now lets say we dynamically allocate a POINT structure.
To access the structure members we need to tell MASM what type of structure the memory represents, and we can do this with ASSUME.


invoke AllocateSomeMemory, sizeof POINT
mov edi, eax ; EDI now contains a ptr to the allocated memory
ASSUME edi:ptr POINT ; this tells MASM that EDI is a ptr to a POINT structure
mov [edi].x, 1 ; which allows us to access the POINT structure members
mov [edi].y, eax

If you don't want to use ASSUME you can manually specify the structure name inside the square brackets.
ASSUME just saves you some typing.


mov [edi.POINT].x, 1
mov [edi.POINT].y, eax

I hope this helps.
Posted on 2004-08-01 08:36:52 by Maelstrom
Hi Maelstrom,

thank for your help.

regard,

bailao
Posted on 2004-08-01 18:44:18 by bailao