Hello,
I'm planning on learning C#. I got myself the program and some books,
but sadly, with the start of school and the fact that I'm in my last
year, we're already getting flooded with work, so I'll have to
postpone my learning of C# a bit.
But there's one thing I could use some help with as I'd like to have
that program as soon as I can. I would think it's fairy simple: it
opens a page, it moves the cursor to a certain absolute coördinate and
clicks (and closes the page by preference).
I got this by compiling bits and strings of codes i could find by
endless googling, but it won't work. Could someone take a look at it?
Or if it's mumbo-jumbo, help me out in another way?
namespace WindowsFormsApplication1
{
static class Program
{
static void Main()
{
System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.StartInfo.FileName = "firefox";
proc.StartInfo.Arguments = "http://www.site-that-i-want-
the-click-for.com/";
proc.Start();
}
[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);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
public Form1()
{
}
public void DoMouseClick()
{
//Call the imported function with the cursor's current
position
int X = Cursor.Position.X;
int Y = Cursor.Position.Y;
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y,
0, 0);
}
}
}
Also not sure but where do I implement the absolute cursor
coördinates?
Sorry if I look like a noob. I am planning to learn it from scratch,
but I just need this asap so I'm being a bit clumsy.
Thanks for any help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---