现也有一个窗口的句柄和这个窗口的设备场景,
我想用鼠标在这个窗口的内部坐标XX,YY单击一次(用程序实现)
在线等待,绝对在您回答完毕后马上给分,多谢

解决方案 »

  1.   

    用mouse_event发送一个消息:
    mouse_event MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_LEFTDOWN,Dx,Dy,0,0
    其中Dx表示鼠标指针沿x坐标轴方向的位置,Dy表示y方向位置。MOUSEEVENTF_ABSOLUTE指定了Dx和Dy为绝对的屏幕坐标。你可以用ClientToScreen将客户区坐标转为绝对坐标。语法如下:
    BOOL ClientToScreen(
      HWND hWnd,       // window handle for source coordinates
      LPPOINT lpPoint  // pointer to structure containing screen coordinates
    );
     
    Parameters
    hWnd 
    Handle to the window whose client area is used for the conversion. 
    lpPoint 
    Pointer to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds. 
    Return Values
    If the function succeeds, the return value is nonzero.
    If the function fails, the return value is zeroPOINT结构语法:
    typedef struct tagPOINT { 
        LONG x; 
        LONG y; 
    } POINT; x 
    Specifies the x-coordinate of the point. 

    Specifies the y-coordinate of the point.