From: yodadrinkslager on
We have a large scale project which most of the users want to behave a
certain way on initialisation however some of us dont. That behaviour
includes moving the mouse cursor to (0,0). Unfortunately this call is
coming from python and I dont know enough about python to stop it
being called. Is there a way I can stop SetCursorPos from doing
anything? I thought about setting a global hook but I am unsure what
to do in the WndProc if I did. Is there any other way?

Thanks
Allan
From: Matti Vuori on
yodadrinkslager <allanmb(a)gmail.com> wrote in news:360c9b4c-d352-493c-8fd3-
0b18ff721372(a)k39g2000yqd.googlegroups.com:
> We have a large scale project which most of the users want to behave a
> certain way on initialisation however some of us dont. That behaviour
> includes moving the mouse cursor to (0,0). Unfortunately this call is
> coming from python and I dont know enough about python to stop it
> being called. Is there a way I can stop SetCursorPos from doing
> anything? I thought about setting a global hook but I am unsure what
> to do in the WndProc if I did. Is there any other way?

If you can figure no other way, a kludge comes to mind: write in another
language a small program that records the cursor position and saves it
somewhere and then launches the actual application, in which you restore
the cursor position the first chance you get.



From: yodadrinkslager on
On 7 July, 16:29, Matti Vuori <xmvu...(a)kolumbus.fi> wrote:
> yodadrinkslager <alla...(a)gmail.com> wrote in news:360c9b4c-d352-493c-8fd3-
> 0b18ff721...(a)k39g2000yqd.googlegroups.com:
>
> > We have a large scale project which most of the users want to behave a
> > certain way on initialisation however some of us dont.  That behaviour
> > includes moving the mouse cursor to (0,0).  Unfortunately this call is
> > coming from python and I dont know enough about python to stop it
> > being called.  Is there a way I can stop SetCursorPos from doing
> > anything?  I thought about setting a global hook but I am unsure what
> > to do in the WndProc if I did.  Is there any other way?
>
> If you can figure no other way, a kludge comes to mind: write in another
> language a small program that records the cursor position and saves it
> somewhere and then launches the actual application, in which you restore
> the cursor position the first chance you get.

I am already saving the mouse pointer before the call is made and then
restoring the mouse to the pre-call position but this is hacky and if
you are moving the mouse at the time it is noticable...

Thanks
Allan
From: Jackie on
yodadrinkslager wrote:
> I am already saving the mouse pointer before the call is made and then
> restoring the mouse to the pre-call position but this is hacky and if
> you are moving the mouse at the time it is noticable...
>
> Thanks
> Allan

As a last resort, I can think of detouring/hooking SetCursorPos (with MS
Detours or similar) in the application calling the API.

The process would be like this:
1. Launch app with DLL
2. Your DLL detours/hooks SetCursorPos
3. App calls the (detoured) SetCursorPos (x number of times), so your
detour is called instead.
4. Restore the real SetCursorPos and return from your detour without
calling the real SetCursorPos.

The result is that SetCursorPos does "nothing".
It's not recommended for production code, but it should be safe when
done right.

--
Regards,
Jackie
From: yodadrinkslager on
On 7 July, 18:49, Jackie <Jac...(a)an.on> wrote:
> yodadrinkslager wrote:
> > I am already saving the mouse pointer before the call is made and then
> > restoring the mouse to the pre-call position but this is hacky and if
> > you are moving the mouse at the time it is noticable...
>
> > Thanks
> > Allan
>
> As a last resort, I can think of detouring/hooking SetCursorPos (with MS
> Detours or similar) in the application calling the API.
>
> The process would be like this:
> 1. Launch app with DLL
> 2. Your DLL detours/hooks SetCursorPos
> 3. App calls the (detoured) SetCursorPos (x number of times), so your
> detour is called instead.
> 4. Restore the real SetCursorPos and return from your detour without
> calling the real SetCursorPos.
>
> The result is that SetCursorPos does "nothing".
> It's not recommended for production code, but it should be safe when
> done right.
>
> --
> Regards,
> Jackie

After finally getting Detours to build (seems VS2008 doesnt support
makerfiles any more so had to use VS2005) I have my detour dll working
but the problem is the calls are coming from Python. I dont know
which exe to inject with my dll :-(

Allan