Just a small snippet

mov eax,(ToggleButtonData PTR ).m_TextOff
;mov ecx,eax
This error is given for DrawText
;tgl.asm(362) : error A2133: register value overwritten by INVOKE
INVOKE DrawText,hdc,eax,-1,ADDR rect,DT_SINGLELINE or DT_CENTER or DT_VCENTER

But this does not occur if I load ecx with eax and then replace eax with ecx in DrawText.

What have I done wrong, I am having trouble opening some of the masm docs with Word 7 from office 95.

Any help would be gladly appreciated.

Thanks guys.
Posted on 2001-09-17 06:09:55 by edgarbrits
ADDR is a macro, the result of which is placed in eax.

You can solve the problem by:
1) moving the offending instance of eax to another register.
2) use "offset" instead of ADDR. This is only possible if it is global data.
3) reproduce what the ADDR macro does by hand in a different (ie free register).


lea ecx, rect
invoke DrawText, .... , ecx, ....


Option 3 will be slightly more "effecient" than option 1, as it removes a redundant "mov" through register re-ordering. However the performance loss will be negligable!

Mirno
Posted on 2001-09-17 06:59:29 by Mirno
Thanks ,
So I was on the Right Track.
Posted on 2001-09-18 03:42:33 by edgarbrits