Scriptiz;754922 said:
Thanks arul for this answer, but how do I do that?
Do you have a sample or a piece of code wich will be more easy to understand
Thanks a lot.
sorry for gravedigging but i hope this helps somebody
i've been trying to solve this, using user32.dll to manipulate clicks and if u have some extention in firefox u can configure it to edit you javascript
here is what it does: with an alredy open window, it "alternates" to its window and clicks or types what i want.
here is the code:
public partial class Form1 : Form
{
// Get a handle to an application window.
[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);
// Activate an application window.
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
//deals with mouse
[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()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Get a handle to the application. The window classand window name were obtained using the Spy++ tool.
IntPtr IEHandle = FindWindow("IEFrame", "Plain Sample Menu - Windows Internet Explorer");
// Verify if is a running process.
if (IEHandle == IntPtr.Zero)
{
MessageBox.Show("Nao esta rodando.");
return;
}
SetForegroundWindow(IEHandle);
Thread.Sleep(2000);
Cursor.Position = new Point(41, 190);
Thread.Sleep(2000);
DoMouseClick();
}
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);
}
}
any doubts add me on msn,
[email protected]