Re: How to convert absolute mouse coordinates to normal positions relative a window?
- From: "Daniel Mattsson" <danmat378852@xxxxxxxxxxxx>
- Date: Wed, 25 May 2005 22:25:35 +0200
Thanks Paul, I did a typecast to int and it seems to work as expected:
screenx = (int)( ( absolutex / 65535.0 ) * screenwidth );
but your solution is perhaps better.
"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
wrote in message news:ufRg5YWYFHA.3184@xxxxxxxxxxxxxxxxxxxxxxx
> Here's how I implement round():
>
> #define round(d) (int)( (d < 0) ? (d-0.5) : (d + 0.5) )
>
> Paul T.
>
> "Daniel Mattsson" <danmat378852@xxxxxxxxxxxx> wrote in message
> news:eksaWVWYFHA.1796@xxxxxxxxxxxxxxxxxxxxxxx
>> Thanks, you are probably right.
>>
>> How to include the round() function to the driver, I get an error
>>
>> error C3861: 'round': identifier not found, even with argument-dependent
>> lookup
>>
>> And the help section shows no requirements or header file for that
>> function?
>>
>> Any ideas?
>>
>> "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
>> wrote in message news:OuAW0AWYFHA.2796@xxxxxxxxxxxxxxxxxxxxxxx
>>> Well, based on the documentation of mouse_event(), it *sounds* like the
>>> absolute coordinate range is 0-65535 and that corresponds to 0-<screen
>>> width or height>, so it should be a simple division problem:
>>>
>>> screenx = round( ( absolutex / 65535.0 ) * screenwidth );
>>>
>>> should be pretty close, I think.
>>>
>>> Paul T.
>>>
>>> "Daniel Mattsson" <danmat378852@xxxxxxxxxxxx> wrote in message
>>> news:OoI$Y2VYFHA.616@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Hi, I´m trying to prevent some mouse messages to be forwarded to some
>>>> applications, but the mouse driver gives me the absolute mouse
>>>> coordinates.
>>>>
>>>> How could I convert them to screen coordinates?
>>>>
>>>> Thanks for helping me out, Dani
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: How to convert absolute mouse coordinates to normal positions relative a window?
- From: Paul G. Tobey [eMVP]
- Re: How to convert absolute mouse coordinates to normal positions relative a window?
- References:
- How to convert absolute mouse coordinates to normal positions relative a window?
- From: Daniel Mattsson
- Re: How to convert absolute mouse coordinates to normal positions relative a window?
- From: Paul G. Tobey [eMVP]
- Re: How to convert absolute mouse coordinates to normal positions relative a window?
- From: Daniel Mattsson
- Re: How to convert absolute mouse coordinates to normal positions relative a window?
- From: Paul G. Tobey [eMVP]
- How to convert absolute mouse coordinates to normal positions relative a window?
- Prev by Date: RE: File Sharing in 5.0
- Next by Date: Re: How to convert absolute mouse coordinates to normal positions relative a window?
- Previous by thread: Re: How to convert absolute mouse coordinates to normal positions relative a window?
- Next by thread: Re: How to convert absolute mouse coordinates to normal positions relative a window?
- Index(es):
Relevant Pages
|