Moving The Mouse/Cursor Then Button Click ?
-
Hi all, I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of. I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button. Can anyone suggest where I need to start looking to allow me to work this one out ? Pete
-
Hi all, I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of. I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button. Can anyone suggest where I need to start looking to allow me to work this one out ? Pete
Fritzables wrote:
then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Is
mouse_event()
of any help here?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi all, I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of. I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button. Can anyone suggest where I need to start looking to allow me to work this one out ? Pete
-
Fritzables wrote:
then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Is
mouse_event()
of any help here?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
G'Day Dave, That sounds the GO, but what about getting the Mouse Cursor in the position I want ? Pete
-
i guess the right way would be the SendMessage function. use it with the parameter WM_LBUTTONUP. walter
Thanks Walter..... have a look at the reply I shot Dave. Pete
-
Hi all, I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of. I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button. Can anyone suggest where I need to start looking to allow me to work this one out ? Pete
I am not sure about a console application. In Windows the mouse pointer is called a ‘cursor’ and you can set the position by calling SetCursorPos(x,y). Note that if ClipCursor was used to limit its rectangular area of movement then it will remain in that area. After setting its position you can post the button-down and button-up messages, in that order, to simulate a button press & release.
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
-
I am not sure about a console application. In Windows the mouse pointer is called a ‘cursor’ and you can set the position by calling SetCursorPos(x,y). Note that if ClipCursor was used to limit its rectangular area of movement then it will remain in that area. After setting its position you can post the button-down and button-up messages, in that order, to simulate a button press & release.
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
Thanks John, Yep, got the cursor now moving all over the place using the Cursor->Position. I will now concentrate on the mouse clicking now. :-) Thanks again John. Pete
-
Thanks John, Yep, got the cursor now moving all over the place using the Cursor->Position. I will now concentrate on the mouse clicking now. :-) Thanks again John. Pete
You are welcome, Just a thought that this may come in handy, if do not have the have the handle to the button and have the handle to the parent then you can call ChildWindowFromPoint to get it. I guess that if you know its coordinates then you already have the handle; anyway I thought I would pass that along. John
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra