2017-12-19 22 views
0

バックグラウンドでBluestackの自動クリックC#アプリケーションを記述する必要があります。 私はAutoit apiを使ってみましたが、クリックするかsendkeyを押すことができますが、ドラッグは&のドロップをサポートしていません。 C#で "user32.dll" PostMessageを使用して解決策を見つけましたが、それはもはやウィンドウ10では機能していないようです。C#自動クリックして別のアプリケーションウィンドウにキーを送信10

誰でも他の解決策があります。助けてください。どうもありがとう!

[DllImport("user32.dll", SetLastError = true)] 
static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); 

PostMessage(handle, (uint)WMessages.WM_LBUTTONDOWN, 0, MAKELPARAM(400, 400)); 

答えて

0

クリックを送信するための正しいウィンドウハンドルを使用していることを確認してください。それは私が窓のそのハンドルにメッセージを送信しようとすると、それはwin10に魅力のように働いたenter image description here

名BlueStacksアンドロイドPluginAndroid {X} {アンドロイドランニングのX =>インスタンス}と
です。ここで

Win32.SendMessage(0x00060714, Win32.WM_LBUTTONDOWN, 0x00000001, 0x1E5025B); 

は私がhere

public class Win32 
    { 
     // The WM_COMMAND message is sent when the user selects a command item from 
     // a menu, when a control sends a notification message to its parent window, 
     // or when an accelerator keystroke is translated. 
     public const int WM_KEYDOWN = 0x100; 
     public const int WM_KEYUP = 0x101; 
     public const int WM_COMMAND = 0x111; 
     public const int WM_LBUTTONDOWN = 0x201; 
     public const int WM_LBUTTONUP = 0x202; 
     public const int WM_LBUTTONDBLCLK = 0x203; 
     public const int WM_RBUTTONDOWN = 0x204; 
     public const int WM_RBUTTONUP = 0x205; 
     public const int WM_RBUTTONDBLCLK = 0x206; 

     // The FindWindow function retrieves a handle to the top-level window whose 
    // class name and window name match the specified strings. 
    // This function does not search child windows. 
    // This function does not perform a case-sensitive search. 
    [DllImport("User32.dll")] 
    public static extern int FindWindow(string strClassName, string strWindowName); 

    // The FindWindowEx function retrieves a handle to a window whose class name 
    // and window name match the specified strings. 
    // The function searches child windows, beginning with the one following the 
    // specified child window. 
    // This function does not perform a case-sensitive search. 
    [DllImport("User32.dll")] 
    public static extern int FindWindowEx(
     int hwndParent, 
     int hwndChildAfter, 
     string strClassName, 
     string strWindowName); 


    // The SendMessage function sends the specified message to a window or windows. 
    // It calls the window procedure for the specified window and does not return 
    // until the window procedure has processed the message. 
    [DllImport("User32.dll")] 
    public static extern Int32 SendMessage(
     int hWnd,    // handle to destination window 
     int Msg,    // message 
     int wParam,    // first message parameter 
     [MarshalAs(UnmanagedType.LPStr)] string lParam); // second message parameter 

    [DllImport("User32.dll")] 
    public static extern Int32 SendMessage(
     int hWnd,    // handle to destination window 
     int Msg,    // message 
     int wParam,    // first message parameter 
     int lParam);   // second message parameter 
} 
から選ん
+0

うわー、ウィッヒウィンドウハンドルツールをありがとうあなたは仲間を使用していますか?WINAPIクラスですか –

+0

Aman Sethさん、ありがとう、私はこのツールを見つけました。それは魅力的に機能しました。いい日があります:) –

+0

こんにちはAman Sethさん、あなたはBSのドラッグアンドドロップをシミュレートするためのソリューションを持っていましたか、WM_LBUTTONDOWNを試してからWM_MOUSEMOVEを試しましたが、うまくいきませんでした。 –

関連する問題