Re: PtInRect return value always zero....
- Posted by euman at bellsouth.net Aug 22, 2001
- 386 views
> 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