leontager Posted June 21, 2003 Posted June 21, 2003 how do i make the mouse click at a certain coordinate that I specify? Quote
leontager Posted June 21, 2003 Author Posted June 21, 2003 oh figured it out Cursor.Position = New Point(Cursor.Position.X - 50, Cursor.Position.Y - 50) Quote
aewarnick Posted June 21, 2003 Posted June 21, 2003 I thought you wanted to click at a certain point? Quote C#
leontager Posted June 21, 2003 Author Posted June 21, 2003 hehe that was my next step. I was so happy I got it to move I forgot all about the click part....So can you help me out on this one? Quote
aewarnick Posted June 21, 2003 Posted June 21, 2003 I know the feeling. I don't know how to send a mouse click to the application but you can programatically click a button or select an item in a listbox ext. Here is an example for a button. Button bu=new Button; bu.PerformClick(); There probably is a windows message you can send to the form that will simulate a click using the Api SendMessage but I have never done that. I have a list of the windows messages if you want that. Quote C#
leontager Posted June 21, 2003 Author Posted June 21, 2003 actually i just really want to have a program that can disconnect me from the internet and since nobody can tell me how on my other post I thought this would be a good temporary solutoin...Of course I would rather have some code to simply to drop the connection so if you or anybody else could advise me on it I will be very pleased:D Quote
*Experts* mutant Posted June 21, 2003 *Experts* Posted June 21, 2003 To simulate a mouse click use the SendInput API. More info: http://www.mentalis.org/apilist/SendInput.shtml The example is in VB6 but very easy to convert to .NET. Quote
leontager Posted June 23, 2003 Author Posted June 23, 2003 sorry for being so annoying buy I am very new to vb and I really tried fixing it to work but it doesnt seem to respont properly. I have to coordinates on which I want to click. One with right click and one with left. on that site there seems to be alot of extra code I dont need. Could you maybe show me a better example of what I need. I also did a bit mroe research and found that maybe its possible to use mouse_event. But again the example is ony for vb6 and it doesnt seem to work on .net. Please help me!!! Quote
*Experts* mutant Posted June 23, 2003 *Experts* Posted June 23, 2003 If you want to use mouse_event this the simplest example: Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer) Const MOUSEEVENTF_LEFTDOWN = &H2 Const MOUSEEVENTF_LEFTUP = &H4 Const MOUSEEVENTF_MOVE = &H1 mouse_event(MOUSEEVENTF_MOVE, x-axiscoord, yaxiscoord, 0, 0) mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) Quote
leontager Posted June 23, 2003 Author Posted June 23, 2003 thank you so much. it works perfectly. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.