i need to move a point structure that i fill when i receive the WM_CONTEXMENU message into another point structure.
.data

hitPt POINT <>
tabHit TCHITTESTINFO <>

.code
.ELSEIF uMsg == WM_CONTEXTMENU ;reveived this message because we right clicked on a tab control
mov eax,lParam ;mov the horizontal and vertical positions where the cursor was into eax
mov hitPt.x,eax ;mov the low word(horizontal postition) into hitPt.x
shr eax,16 ;mov high word into low word
mov hitPt.y,eax ;mov the low word(vertical position) into hitPt.y
invoke ScreenToClient,hTab,addr hitPt ;convert to client cordinates to use with TCM_HITTEST

;mov eax,hitPt ;<--- here is my problem. i need to mov one point struct into
;mov tabHit.pt,eax ;<--- another point struct. at the same time this will fill my TCHITTESTINFO(tabHit)

invoke SendMessage,hTab,TCM_HITTEST,0,addr tabHit ;check to see if the we right clicked in a tab on the tab control
.if eax == -1 ;if we didnt click on a tab then show a messagebox
invoke MessageBox,0,0,0,0
.endif
Posted on 2002-05-23 21:14:12 by smurf
smurf,

With a single POINT structure, I would be inclined to use PUSH/POP on the two values as it does not depend on using a register.

On larger structures, you can just load the two start addresses and copy one to another but with only 2 values, that would probably be slower.

Regards,

hutch@movsd.com
Posted on 2002-05-23 21:37:11 by hutch--
The POINT structure is defined in windows.inc as such:


POINT STRUCT
x DWORD ?
y DWORD ?
POINT ENDS

It's just a simple structure of two dwords. To move it, just move both pieces:


mov eax, hitPt.x
mov tabHit.pt.x, eax
mov eax, hitPt.y
mov tabHit.pt.y, eax
Posted on 2002-05-23 21:38:20 by Ernie
hutch: i tryed the push/pop method but i was getting errors

ernie: that will work just fine.

i appreciate the help. thanks guys.
Posted on 2002-05-23 21:42:22 by smurf
i was hoping someone could tell me if i did this part of my code right.

   .ELSEIF uMsg == WM_CONTEXTMENU  ;reveived this message because we right clicked on a tab control

mov eax,lParam ;mov the horizontal and vertical positions where the cursor was into eax
mov hitPt.x,eax ;mov the low word(horizontal postition) into hitPt.x
shr eax,16 ;mov high word into low word
mov hitPt.y,eax ;mov the low word(vertical position) into hitPt.y cordinates to use with TCM_HITTEST


ive tested the rest of my code and it works when i use the getcursorpos api. so i know my problem lies with the code above. am i doing something wrong?
Posted on 2002-05-24 00:06:00 by smurf
mov eax,lParam
and eax,0xFFFF ;<- You must mask out the lowword
mov hitPt.x,eax
mov eax,lParam
shr eax,16
mov hitPt.y,eax
Posted on 2002-05-24 00:37:34 by gliptic
smurf,

Ernies method using a register is a good one but it uses a register when you don't always have one available,


push hitPt.x
pop tabHit.pt.x
push hitPt.y
pop tabHit.pt.y

This should do the copy without register usage.

Regards,

hutch@movsd.com
Posted on 2002-05-24 02:41:22 by hutch--