各位,我想实现QQ视频的自动接受,然后就想如果能模拟鼠标单击视频的那个“接受”按钮就可以了。但是不行,大体代码如下,大家帮忙看看,或有什么参考资料,谢谢啊。
            [DllImport("user32.dll")]
            public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);            [DllImport("user32.dll")]
            public static extern int SendMessage(IntPtr window, int message, int wparam, int lparam);            [DllImport("user32", CharSet = CharSet.Auto)]
            public extern static int SendMessage(IntPtr hWnd, int wMsg, int wParam, string lpstring);            [DllImport("user32.dll")]
            public static extern int PostMessage(IntPtr window, int message, int wparam, int lparam);
       
            [DllImport("user32.dll", EntryPoint = "SetForegroundWindow", SetLastError = true)]
            public static extern void SetForegroundWindow(IntPtr hwnd);            public const int MOUSEEVENTF_LEFTDOWN = 0x21;
            public const int MOUSEEVENTF_LEFTUP = 0x202;            int x = 455;//x,y是用spy++截取到的
            int y = 300;            IntPtr iHandle = FindWindow("TXGuiFoundation", "视频界面的名字");//能够成功获取窗口句柄
            SetForegroundWindow(iHandle1); 
            //一点反应也没有
            SendMessage(iHandle, MOUSEEVENTF_LEFTDOWN, 0, x + (y << 16));
            SendMessage(iHandle, MOUSEEVENTF_LEFTUP, 0, x + (y << 16));            //用下面这种方式也不行
           // int result1=Win32.PostMessage(iHandle1, MOUSEEVENTF_LEFTDOWN, 0, x + (y << 16));
           //int result2= Win32.PostMessage(iHandle1, MOUSEEVENTF_LEFTUP, 0, x + (y << 16));          以下是我用spy++获取的信息
<01886> 00090864 S WM_SETFOCUS hwndLoseFocus:(null)
<01887> 00090864 R WM_SETFOCUS
<01888> 00090864 R WM_ACTIVATE
<01889> 00090864 S WM_SETCURSOR hwnd:00090864 nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN
<01890> 00090864 R WM_SETCURSOR fHaltProcessing:False
<01891> 00090864 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:452 yPos:301
//以下应该不是了,有人说QQ界面的按钮是自绘的,下面也真有WM_PAINT消息,但是貌似没什么关系吧?
<01892> 00090864 S WM_PAINT hdc:00000000
<01893> 00090864 R WM_PAINT
<01894> 00090864 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:452 yPos:301
<01895> 00090864 P WM_PAINT hdc:00000000
<01896> 00090864 P WM_LBUTTONUP fwKeys:0000 xPos:452 yPos:301
<01897> 00090864 S WM_CAPTURECHANGED hwndNewCapture:00000000
<01898> 00090864 R WM_CAPTURECHANGED
<01899> 00090864 S WM_PARENTNOTIFY fwEvent:WM_CREATE idChild:0001 (1) hwndChild:00090416
<01900> 00090864 R WM_PARENTNOTIFY
<01901> 00090864 S WM_PARENTNOTIFY fwEvent:WM_CREATE idChild:0001 (1) hwndChild:00090528
<01902> 00090864 R WM_PARENTNOTIFY各位大哥,有什么方法不?还是我哪边错了?还是压根没什么办法?谢谢各位了!
            

解决方案 »

  1.   

    UserVar Var1=DropList{8000:8000|10000:10000|15000:15000}=1 打多长时间
    Rem denga
    Rem 看人出来没有
    IfColor 85,57,20ea6,0
    Else 
        Delay 1000
        Goto denga
    EndIf 
    Rem 食技能珠
    MoveTo 610,10
    Delay 200
    LeftClick 1
    Delay 300
    KeyPress 73,1
    Delay 200
    VBSCall FindColorEx(1121,452,1231,631,"3436ff",0,0.8,a,b)
    Delay 100
    MoveTo a,b
    Delay 100
    RightClick 1
    Delay 200
    KeyPress 73,1
    Delay 200
    KeyPress 119,1
    Rem 等待开始
    Rem 点外挂传送要挂机的地方
    Rem 判断开始出现
    IfColor 870,912,5050ff,0
    Else 
        Delay 100
        Goto 等待开始
    EndIf 
    Rem Delay 100
    Rem MoveTo 269,765
    Rem Delay 100
    Rem LeftClick 1
    Rem Delay 200
    Rem MoveTo 610,10
    Rem Delay 200
    Rem LeftClick 1
    Rem Delay 300
    Rem KeyPress 119,1
    Rem 边打边判断蓝多少   共8秒
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    IfColor 137,72,222222,0
        KeyPress 187,1
    Else 
    EndIf 
    Delay 1000
    KeyPress 119,1
    Rem 判断有没有死亡
    IfColor 80,56,151da8,1
        Delay 200
        KeyPress 119,1
        Delay 2000
        MoveTo 639,393
        Delay 2000
        LeftClick 1
        Delay 2000
        For 2
            KeyPress 27,1
        EndFor 
        IfColor 613,313,f3973d,0
            MoveTo 636,409
            Delay 1000
            LeftClick 1
            Goto dang
        Else 
        EndIf 
    Else 
    EndIf 
    Rem 判断有没有断线
    IfColor 437,262,b12ee,0
        VBSCall RunApp("D:\迅雷广告绿色\Program\download-complete.wav")
    EndScript 
    Else 
    EndIf 
    KeyPress 27,1
    Delay 200
    MoveTo 636,409
    Delay 20
    LeftClick 1
    Rem dang
    Rem deng
    IfColor 1025,385,eeeeee,0
    Else 
        Delay 1000
        Goto deng
    EndIf 
    For 3
        KeyPress 13,1
        Delay 100
    EndFor 
    Delay 500
      

  2.   

    using System.RunTime.InteropServices;private const int WM_LBUTTONDOWN = 513; // 0x0201   
    private const int WM_LBUTTONUP = 514; // 0x0202   
    [System.Runtime.InteropServices.DllImport( "user32.dll ")]   
    static extern bool SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, Int32 lParam);   private void SetNoCurrentCell()   
    {   
        
      SendMessage(Form2.Handle, WM_LBUTTONDOWN, 0, 0);   
      SendMessage(Form2.Handle, WM_LBUTTONUP, 0, 0);   
    http://topic.csdn.net/u/20090106/12/8c4c1a5d-4e99-4f3f-b0cd-e1c0129e2a29.html
      

  3.   

    终于搞定了,最后用了SetCursorPos和mouse_event。谢谢各位了。