Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: Calling java from C# Pin
KASR111-Jan-12 0:05
KASR111-Jan-12 0:05 
GeneralRe: Calling java from C# Pin
Richard MacCutchan11-Jan-12 2:43
mveRichard MacCutchan11-Jan-12 2:43 
GeneralRe: Calling java from C# Pin
Pete O'Hanlon11-Jan-12 5:11
mvePete O'Hanlon11-Jan-12 5:11 
GeneralRe: Calling java from C# Pin
Richard MacCutchan11-Jan-12 5:22
mveRichard MacCutchan11-Jan-12 5:22 
AnswerRe: Calling java from C# Pin
Abhinav S9-Jan-12 22:18
Abhinav S9-Jan-12 22:18 
AnswerRe: Calling java from C# Pin
jschell11-Jan-12 9:31
jschell11-Jan-12 9:31 
QuestionHow can i perform multiple mouse clicks at the same time on desktop??? Pin
A7mad_9-Jan-12 20:59
A7mad_9-Jan-12 20:59 
AnswerRe: How can i perform multiple mouse clicks at the same time on desktop??? PinPopular
Wayne Gaylard9-Jan-12 22:18
professionalWayne Gaylard9-Jan-12 22:18 
You are going to have to use a User32 API function mouse_event. First off, import System.Runtime.InteropServices into your class, then declare the function import:-

C#
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);

You then need to declare constants for the relevant mouse actions :-

C#
private const int MOUSE_LEFTDOWN = 0x02;
       private const int MOUSE_LEFTUP = 0x04;
       private const int MOUSE_RIGHTDOWN = 0x08;
       private const int MOUSE_RIGHTUP = 0x10;

Then you can create a function that clicks the mouse at a specific location on the screen :-

C#
public void ClickMouse(int x, int y)
       {
           Cursor.Position = new Point(x, y);
           mouse_event(MOUSE_LEFTDOWN | MOUSE_LEFTUP, x, y, 0, 0);
       }


You should be aware that there could be snags with this, i.e. the speed with which you click could mean mouse clicks getting lost if they are too fast, etc. Also, you will need to be aware of the users screen resolution, else if you hard code specific points to click, they will be off screen if the users resolution is less than yours etc.

Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

GeneralRe: How can i perform multiple mouse clicks at the same time on desktop??? Pin
A7mad_16-Jan-12 0:33
A7mad_16-Jan-12 0:33 
AnswerRe: How can i perform multiple mouse clicks at the same time on desktop??? Pin
BillWoodruff10-Jan-12 6:01
professionalBillWoodruff10-Jan-12 6:01 
GeneralRe: How can i perform multiple mouse clicks at the same time on desktop??? Pin
A7mad_16-Jan-12 0:36
A7mad_16-Jan-12 0:36 
QuestionMultiThread Management Pin
Joezer BH9-Jan-12 19:37
professionalJoezer BH9-Jan-12 19:37 
AnswerRe: MultiThread Management Pin
Eddy Vluggen10-Jan-12 7:07
professionalEddy Vluggen10-Jan-12 7:07 
GeneralRe: MultiThread Management Pin
Joezer BH10-Jan-12 8:45
professionalJoezer BH10-Jan-12 8:45 
GeneralRe: MultiThread Management Pin
Pete O'Hanlon10-Jan-12 9:18
mvePete O'Hanlon10-Jan-12 9:18 
GeneralRe: MultiThread Management Pin
Joezer BH10-Jan-12 20:46
professionalJoezer BH10-Jan-12 20:46 
QuestionC# how I can sniff a process? Pin
terrinfo9-Jan-12 14:01
terrinfo9-Jan-12 14:01 
AnswerRe: C# how I can sniff a process? Pin
Not Active9-Jan-12 14:23
mentorNot Active9-Jan-12 14:23 
AnswerRe: C# how I can sniff a process? Pin
Abhinav S9-Jan-12 19:41
Abhinav S9-Jan-12 19:41 
GeneralRe: C# how I can sniff a process? Pin
terrinfo9-Jan-12 23:19
terrinfo9-Jan-12 23:19 
GeneralRe: C# how I can sniff a process? Pin
Richard MacCutchan10-Jan-12 2:36
mveRichard MacCutchan10-Jan-12 2:36 
GeneralRe: C# how I can sniff a process? Pin
terrinfo10-Jan-12 3:06
terrinfo10-Jan-12 3:06 
GeneralRe: C# how I can sniff a process? Pin
Richard MacCutchan10-Jan-12 3:26
mveRichard MacCutchan10-Jan-12 3:26 
GeneralRe: C# how I can sniff a process? Pin
terrinfo10-Jan-12 3:32
terrinfo10-Jan-12 3:32 
GeneralRe: C# how I can sniff a process? Pin
Richard MacCutchan10-Jan-12 3:45
mveRichard MacCutchan10-Jan-12 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.