1. PtInRect return value always zero....

Hello,

I need help with this, it doesnt seem to work at all...

</snip>

c_proc(xGetCursorPos, {pt} ) 

junk = c_func(xScreenToClient, {hwnd, pt}) 

c_proc(xGetWindowRect, {cntrl_id, rect} 

junk = c_func(xPtInRect, {rect, pt}) 

<snip\>

First I retrieve the CursorPos and convert this to ClientCoords
next, I retrieve the WindowRect which sets (rect) the coords to 
ctrl_id and test to see if the ClientCoord (pt) resides within 
WindowRect (rect) with xPtInRect..

Very Simple and should work according to MS.... ;-0

hwnd and ctrl_id's handle, rect and pt address's are aquired already
and, are valid id's and address's

I traced this out by peeking the pt and rect values and 
according to the info I recieved and, the position of the Cursor
relative to the ctrl_id area junk @ xPtInRect should be nonzero
but, it always returns zero.

Anyone faced this problem?

It's really a trivial problem, I have a method that works for what I need
to accomplish at the moment so, no-one strain for an answer..
  
Euman
euman at bellsouth.net

new topic     » topic index » view message » categorize

2. Re: PtInRect return value always zero....

Before I get 1000 replies telling me to drop the
junk = c_func(xScreenToClient, {hwnd, pt}) 
there is a reason for this, I hadnt explained yet.

Just know that my WindowRect is 0, 0 rect_left / top

Later,

Euman
euman at bellsouth.net


> Hello,
> 
> I need help with this, it doesnt seem to work at all...
> 
> </snip>
> 
> c_proc(xGetCursorPos, {pt} ) 
> 
> junk = c_func(xScreenToClient, {hwnd, pt}) 
> 
> c_proc(xGetWindowRect, {cntrl_id, rect} 
> 
> junk = c_func(xPtInRect, {rect, pt}) 
> 
> <snip\>
> 
> First I retrieve the CursorPos and convert this to ClientCoords
> next, I retrieve the WindowRect which sets (rect) the coords to 
> ctrl_id and test to see if the ClientCoord (pt) resides within 
> WindowRect (rect) with xPtInRect..
> 
> Very Simple and should work according to MS.... ;-0
> 
> hwnd and ctrl_id's handle, rect and pt address's are aquired already
> and, are valid id's and address's
> 
> I traced this out by peeking the pt and rect values and 
> according to the info I recieved and, the position of the Cursor
> relative to the ctrl_id area junk @ xPtInRect should be nonzero
> but, it always returns zero.
> 
> Anyone faced this problem?
> 
> It's really a trivial problem, I have a method that works for what I need
> to accomplish at the moment so, no-one strain for an answer..
>   
> Euman
> euman at bellsouth.net
> 
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: PtInRect return value always zero....

----- Original Message -----
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Subject: PtInRect return value always zero....


>
> Hello,
>
> I need help with this, it doesnt seem to work at all...
>
> </snip>
>
> c_proc(xGetCursorPos, {pt} )
>
> junk = c_func(xScreenToClient, {hwnd, pt})
>
> c_proc(xGetWindowRect, {cntrl_id, rect}
>
> junk = c_func(xPtInRect, {rect, pt})
>
> <snip\>
>
> First I retrieve the CursorPos and convert this to ClientCoords
> next, I retrieve the WindowRect which sets (rect) the coords to
> ctrl_id and test to see if the ClientCoord (pt) resides within
> WindowRect (rect) with xPtInRect..
>
> Very Simple and should work according to MS.... ;-0
>
> hwnd and ctrl_id's handle, rect and pt address's are aquired already
> and, are valid id's and address's
>
> I traced this out by peeking the pt and rect values and
> according to the info I recieved and, the position of the Cursor
> relative to the ctrl_id area junk @ xPtInRect should be nonzero
> but, it always returns zero.
>
> Anyone faced this problem?
>
> It's really a trivial problem, I have a method that works for what I need
> to accomplish at the moment so, no-one strain for an answer..
>
> Euman
> euman at bellsouth.net
>

I think I've worked this one out, finally.

I believe the problem is that the parameters being passed are wrong.
According to the SDK docs, you need to pass the address of a RECT structure
and a POINT structure. Note, it is not the address of the POINT, but the
actual POINT structure itself.

So may this is more like what is required...

  atom x,y
  x = peek4u(pt)
  y = peek4u(pt+4)
 junk = c_func(xPtInRect, {rect, x, y})

------
Derek

new topic     » goto parent     » topic index » view message » categorize

4. Re: PtInRect return value always zero....

> From: <euman at bellsouth.net>
> > Hello,
> >
> > I need help with this, it doesnt seem to work at all...
> >
> > </snip>
> >
> > c_proc(xGetCursorPos, {pt} )
> >
> > junk = c_func(xScreenToClient, {hwnd, pt})
> >
> > c_proc(xGetWindowRect, {cntrl_id, rect}
> >
> > junk = c_func(xPtInRect, {rect, pt})
> >
> > <snip\>
> >
> > First I retrieve the CursorPos and convert this to ClientCoords
> > next, I retrieve the WindowRect which sets (rect) the coords to
> > ctrl_id and test to see if the ClientCoord (pt) resides within
> > WindowRect (rect) with xPtInRect..
> >
> > Very Simple and should work according to MS.... ;-0
> >
> > hwnd and ctrl_id's handle, rect and pt address's are aquired already
> > and, are valid id's and address's
> >
> > I traced this out by peeking the pt and rect values and
> > according to the info I recieved and, the position of the Cursor
> > relative to the ctrl_id area junk @ xPtInRect should be nonzero
> > but, it always returns zero.
> >
> > Anyone faced this problem?
> >
> > It's really a trivial problem, I have a method that works for what I need
> > to accomplish at the moment so, no-one strain for an answer..
> >
> > Euman
> > euman at bellsouth.net
> >
> 
> I think I've worked this one out, finally.
> 
> I believe the problem is that the parameters being passed are wrong.
> According to the SDK docs, you need to pass the address of a RECT structure
> and a POINT structure. 
> Note, it is not the address of the POINT, but the
> actual POINT structure itself.

Your very observant, I thought about this for about 10 minutes
after I wrote the question and dropped it because I used Euphoria's
internal methods which prove to be really fast and do the job..

Thanks Derek, I really didnt think anyone would get this one.

> 
> So may this is more like what is required...
> 
>   atom x,y
>   x = peek4u(pt)
>   y = peek4u(pt+4)
>  junk = c_func(xPtInRect, {rect, x, y})
> 
> ------
> Derek

new topic     » goto parent     » topic index » view message » categorize

5. Re: PtInRect return value always zero....

> So may this is more like what is required...
> 
>   atom x,y
>   x = peek4u(pt)
>   y = peek4u(pt+4)
>  junk = c_func(xPtInRect, {rect, x, y})
> 
> ------
> Derek

I decided to try your theory and PtInRect only excepts two arguments
maybe I'll play with this some and see if I can get it to work...

Euman
euman at bellsouth.net

new topic     » goto parent     » topic index » view message » categorize

6. Re: PtInRect return value always zero....

Ok, I changed this and it does work now
Thanks Derek..

xPtInRect = link_c_func(user32,"PtInRect",{C_POINTER,C_INT,C_INT},C_UINT)

Euman
euman at bellsouth.net

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu