mouse_event在win xp虽然已经有代替它的函数,那么mouse_event是否还被xp支持?
mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_LEFTDOWN,400,400,0,0);
为什么我400,400无论定义何值,结果都是在当前鼠标位置起作用?

解决方案 »

  1.   

    要分开来吧:
    mouse_event(MOUSEEVENTF_ABSOLUTE,400,400,0,0);
    sleep(10);
    mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
      

  2.   

    不过最好还是用SetCursorPos();
    SetCursorPos(400,400);
    mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
    mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
      

  3.   

    你用SetCursorPos不是很好...BOOL SetCursorPos(          int X,
        int Y
    );
    ParametersX
    [in] Specifies the new x-coordinate of the cursor, in screen coordinates. 
    Y
    [in] Specifies the new y-coordinate of the cursor, in screen coordinates. 
      

  4.   

    SetCursorPos(400,400);我知道,只是觉得奇怪MSDN明明写了MOUSEEVENTF_ABSOLUTE是绝对位置的