Click here to Skip to main content
15,892,161 members
Home / Discussions / C#
   

C#

 
AnswerRe: DataGridView Pin
Keith Barrow25-Feb-15 3:37
professionalKeith Barrow25-Feb-15 3:37 
Questionmouse simulation code c# Pin
Omarkkk24-Feb-15 21:55
Omarkkk24-Feb-15 21:55 
AnswerRe: mouse simulation code c# Pin
OriginalGriff24-Feb-15 22:07
mveOriginalGriff24-Feb-15 22:07 
GeneralRe: mouse simulation code c# Pin
Omarkkk24-Feb-15 22:11
Omarkkk24-Feb-15 22:11 
GeneralRe: mouse simulation code c# Pin
OriginalGriff24-Feb-15 22:13
mveOriginalGriff24-Feb-15 22:13 
GeneralRe: mouse simulation code c# Pin
Omarkkk24-Feb-15 22:16
Omarkkk24-Feb-15 22:16 
GeneralRe: mouse simulation code c# Pin
Omarkkk24-Feb-15 22:18
Omarkkk24-Feb-15 22:18 
GeneralRe: mouse simulation code c# Pin
OriginalGriff24-Feb-15 22:44
mveOriginalGriff24-Feb-15 22:44 
Well, you could start by using .NET cursor movement:
C#
Point current = Cursor.Position;
Cursor.Position = new Point(current.X + 50, current.Y + 10);

And then this works for me:
C#
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

private const uint MOUSEEVENTF_LEFTDOWN = 0x02;
private const uint MOUSEEVENTF_LEFTUP = 0x04;
private const uint MOUSEEVENTF_RIGHTDOWN = 0x08;
private const uint MOUSEEVENTF_RIGHTUP = 0x10;
private void butClickMe_Click(object sender, EventArgs e)
    {
    Point current = Cursor.Position;
    Cursor.Position = new Point(current.X + 50, current.Y + 10);
    mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, Cursor.Position.X, Cursor.Position.Y, 0, 0);
    }
By putting a second button on the form, slightly right and down from the first, it gets clicked every time...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: mouse simulation code c# Pin
Omarkkk26-Feb-15 0:52
Omarkkk26-Feb-15 0:52 
GeneralRe: mouse simulation code c# Pin
OriginalGriff26-Feb-15 1:05
mveOriginalGriff26-Feb-15 1:05 
GeneralRe: mouse simulation code c# Pin
Omarkkk26-Feb-15 1:23
Omarkkk26-Feb-15 1:23 
GeneralRe: mouse simulation code c# Pin
OriginalGriff26-Feb-15 1:59
mveOriginalGriff26-Feb-15 1:59 
AnswerRe: mouse simulation code c# Pin
Manfred Rudolf Bihy24-Feb-15 22:40
professionalManfred Rudolf Bihy24-Feb-15 22:40 
QuestionConvert code C# 2008 to code C# 2005 ? Pin
Member 245846724-Feb-15 21:39
Member 245846724-Feb-15 21:39 
AnswerRe: Convert code C# 2008 to code C# 2005 ? Pin
Simon_Whale24-Feb-15 21:56
Simon_Whale24-Feb-15 21:56 
AnswerRe: Convert code C# 2008 to code C# 2005 ? Pin
OriginalGriff24-Feb-15 22:05
mveOriginalGriff24-Feb-15 22:05 
GeneralRe: Convert code C# 2008 to code C# 2005 ? Pin
Member 245846725-Feb-15 16:22
Member 245846725-Feb-15 16:22 
GeneralRe: Convert code C# 2008 to code C# 2005 ? Pin
OriginalGriff25-Feb-15 21:51
mveOriginalGriff25-Feb-15 21:51 
GeneralRe: Convert code C# 2008 to code C# 2005 ? Pin
Member 24584673-Mar-15 15:42
Member 24584673-Mar-15 15:42 
QuestionInsert the data of datagridview in a database. Pin
Ibrahim.elh24-Feb-15 20:45
Ibrahim.elh24-Feb-15 20:45 
QuestionRe: Insert the data of datagridview in a database. Pin
Eddy Vluggen25-Feb-15 0:31
professionalEddy Vluggen25-Feb-15 0:31 
AnswerRe: Insert the data of datagridview in a database. Pin
Ibrahim.elh25-Feb-15 1:55
Ibrahim.elh25-Feb-15 1:55 
GeneralRe: Insert the data of datagridview in a database. Pin
Richard Deeming25-Feb-15 2:09
mveRichard Deeming25-Feb-15 2:09 
GeneralRe: Insert the data of datagridview in a database. Pin
Ibrahim.elh25-Feb-15 2:58
Ibrahim.elh25-Feb-15 2:58 
GeneralRe: Insert the data of datagridview in a database. Pin
Richard Deeming25-Feb-15 3:02
mveRichard Deeming25-Feb-15 3:02 

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.