Reputation: 21
I'm busy making a application where i can use the Leap as a mouse. I'm making a WPF application with C# and XAML. I allready can move the cursor, but i have problems making a function to activate the left mouse button. Can someone help me with this problem? I need to activate buttons created in XAML. Another solution could be a function that activates a button when de Leap cursor is on the button for like 3 seconds. I can't find any examples on the Internet. Does someone have a simple basic program or example for me? Please help!
Here is a link to the application i allready have. Maybe it helps https://www.dropbox.com/sh/kp51hdbhcacaky7/pdinDQpA-6
Upvotes: 2
Views: 1112
Reputation: 64
About the "mouse over button" thing - u can try this solution (worked for me):
hope it halped :)
Upvotes: 1
Reputation: 64
try this:
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int 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 static void DoMouseClick()
{
Point mousePoint = GetMousePosition();
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, (int)mousePoint.X, (int)mousePoint.Y, 0, 0);
}
Upvotes: 0