SetCursorPos 
Author Message
 SetCursorPos

Is it possible to set the cursor position to a location that is
outside the visible area of the screen?

I know this sounds a bit odd but I need to click a button in another
app.  First these "buttons" are not real buttons meaning their class
name is not "Button" but rather it is "Static".  It seems as though
the other app the click messages are sen to the apps main window and
then it determines what has been clicked by the mouse coordinates at
the time of the message.  This means that I can cause a click on this
"button" provided I first set the cursor position to be over the
button.  This works perfectly well except in situations where the
"button" I need to click is located off the visible are of the
screen.  It seems as though the SetCursorPos API limits the position
to be within the viewable screen area regardless of the value sent.

So the question again is; is there any wat to move the cursor to a
position that is ouside the screen area?

Thanks,
Steve



Thu, 02 Feb 2012 04:11:12 GMT  
 SetCursorPos

Quote:
> Is it possible to set the cursor position to a location that is
> outside the visible area of the screen?

> I know this sounds a bit odd but I need to click a button in another
> app.  First these "buttons" are not real buttons meaning their class
> name is not "Button" but rather it is "Static".  It seems as though
> the other app the click messages are sen to the apps main window and
> then it determines what has been clicked by the mouse coordinates at
> the time of the message.  This means that I can cause a click on this
> "button" provided I first set the cursor position to be over the
> button.  This works perfectly well except in situations where the
> "button" I need to click is located off the visible are of the
> screen.  It seems as though the SetCursorPos API limits the position
> to be within the viewable screen area regardless of the value sent.

> So the question again is; is there any wat to move the cursor to a
> position that is ouside the screen area?

One easy approach is to enable multiple monitors, and move the app to
different monitor. Cheap graphic cards(<$30) can do multiple monitors
easily.


Thu, 02 Feb 2012 04:36:01 GMT  
 SetCursorPos



Quote:
> Is it possible to set the cursor position to a location that is
> outside the visible area of the screen?

> I know this sounds a bit odd but I need to click a button in another
> app.  First these "buttons" are not real buttons meaning their class
> name is not "Button" but rather it is "Static".  It seems as though
> the other app the click messages are sen to the apps main window and
> then it determines what has been clicked by the mouse coordinates at
> the time of the message.  This means that I can cause a click on this
> "button" provided I first set the cursor position to be over the
> button.  This works perfectly well except in situations where the
> "button" I need to click is located off the visible are of the
> screen.  It seems as though the SetCursorPos API limits the position
> to be within the viewable screen area regardless of the value sent.

> So the question again is; is there any wat to move the cursor to a
> position that is ouside the screen area?

> Thanks,
> Steve

Isn't it possible to mimic the button click by sending a MouseDown with the
coordinates of the button to the Form?

/Henning



Thu, 02 Feb 2012 06:09:59 GMT  
 SetCursorPos

Quote:

> > Is it possible to set the cursor position to a location that is
> > outside the visible area of the screen?

> > I know this sounds a bit odd but I need to click a button in another
> > app. ?First these "buttons" are not real buttons meaning their class
> > name is not "Button" but rather it is "Static". ?It seems as though
> > the other app the click messages are sen to the apps main window and
> > then it determines what has been clicked by the mouse coordinates at
> > the time of the message. ?This means that I can cause a click on this
> > "button" provided I first set the cursor position to be over the
> > button. ?This works perfectly well except in situations where the
> > "button" I need to click is located off the visible are of the
> > screen. ?It seems as though the SetCursorPos API limits the position
> > to be within the viewable screen area regardless of the value sent.

> > So the question again is; is there any wat to move the cursor to a
> > position that is ouside the screen area?

> > Thanks,
> > Steve

> Isn't it possible to mimic the button click by sending a MouseDown with the
> coordinates of the button to the Form?

> /Henning- Hide quoted text -

> - Show quoted text -

No I tried, that does not work either


Thu, 02 Feb 2012 06:25:29 GMT  
 SetCursorPos

Quote:


> > > Is it possible to set the cursor position to a location that is
> > > outside the visible area of the screen?

> > > I know this sounds a bit odd but I need to click a button in another
> > > app. ?First these "buttons" are not real buttons meaning their class
> > > name is not "Button" but rather it is "Static". ?It seems as though
> > > the other app the click messages are sen to the apps main window and
> > > then it determines what has been clicked by the mouse coordinates at
> > > the time of the message. ?This means that I can cause a click on this
> > > "button" provided I first set the cursor position to be over the
> > > button. ?This works perfectly well except in situations where the
> > > "button" I need to click is located off the visible are of the
> > > screen. ?It seems as though the SetCursorPos API limits the position
> > > to be within the viewable screen area regardless of the value sent.

> > > So the question again is; is there any wat to move the cursor to a
> > > position that is ouside the screen area?

> > > Thanks,
> > > Steve

> > Isn't it possible to mimic the button click by sending a MouseDown with the
> > coordinates of the button to the Form?

> > /Henning- Hide quoted text -

> > - Show quoted text -

> No I tried, that does not work either

The only success I have ever had influencing one program with another
is with inter program communication.

Check out "Link Topic" and its related parts

Duke



Fri, 03 Feb 2012 00:27:27 GMT  
 SetCursorPos

Quote:
> Isn't it possible to mimic the button click by sending a MouseDown with
> the coordinates of the button to the Form?

You don't send a MouseDown; that's an event. Perhaps you were thinking of
the mouse_event() API function? Steve, have you looked into that one?


Mon, 06 Feb 2012 03:36:35 GMT  
 SetCursorPos

Quote:
>> Isn't it possible to mimic the button click by sending a MouseDown with
>> the coordinates of the button to the Form?

> You don't send a MouseDown; that's an event. Perhaps you were thinking of
> the mouse_event() API function? Steve, have you looked into that one?

Oops, mouse_event() has been superseded by SendInput(). Check that one out.

(Hmmm, this still may not work. The docs seem to indicate that the x/y
coordinates are mapped to the display, and as such cannot specify locations
outside of the display.)



Mon, 06 Feb 2012 03:43:53 GMT  
 SetCursorPos

Quote:


> >> Isn't it possible to mimic the button click by sending a MouseDown with
> >> the coordinates of the button to the Form?

> > You don't send a MouseDown; that's an event. Perhaps you were thinking of
> > the mouse_event() API function? Steve, have you looked into that one?

> Oops, mouse_event() has been superseded by SendInput(). Check that one out.

> (Hmmm, this still may not work. The docs seem to indicate that the x/y
> coordinates are mapped to the display, and as such cannot specify locations
> outside of the display.)

Further problem with both of these (mouse_event() is still available)
is that since no hWnd is specified, they click whatever is at the
specified coordinates.  This works fine when the window is A) within
the viewable area and B) not obscured by some other window.  In the
case of the latter the button click goes to the visible (top of the Z-
order) at the specified location.

Steve



Mon, 06 Feb 2012 04:48:54 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. SetCursorPos

2. setcursorpos API function

3. SetCursorPos in Win2000

4. SetCursorPos api in Win 2000 (re-post)

5. Can't SetCursorPos after clicking on menu bar

6. SetCursorPos & SetWindowPos from VB3

7. SetCursorPos and SetWindowPos

8. Problem with SetCursorPos

9. SetCursorPos

 

 
Powered by phpBB® Forum Software