you can get the mouse coordinates using GetCursorPos as shown
Finding the X and Y co-ordinates of the mouse pointer
http://216.26.168.92/mouse/tip65.htmlif that is not what you want, try to install a mouse hook, see discussions here:http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20105958.html

解决方案 »

  1.   

    GetCursorPos不行么??指针不是只有一个么???
      

  2.   

    GetCursorPos是返回鼠标指针的位置
    可能是我没说清楚,我想要得到的是鼠标指针,要在设备场景中用鼠标指针画出鼠标图案,不同的地方返回的鼠标指针是不同的,再顶哎
      

  3.   

    感谢chenyu5188(蓝色情调) 的up,等结帐时送你20
    怎么还没人知道啊?或者这么说,谁知道如何在截获屏幕图片的时候连同鼠标一同截获?
      

  4.   

    倒了,这样看来,chenyu5188(蓝色情调) 的up没有20分了,我是按照比例来分配分数的呀,回答正确的给80,其他up的大家分配分配把,呵呵:(
      

  5.   

    GetCursor是获取目前选择的鼠标指针的句柄。
    其实你的目的就是要获取当前的鼠标句柄啊?没错啊??
    用这个涵数获取句柄后,画出来的当然就是屏幕当前的鼠标样子了嘛,难道不是吗?
      

  6.   

    GetCursor是获取目前选择的鼠标指针的句柄。
    ====================================================================
    错!GetCursor只能获取当前进程的鼠标句柄
    其他的进程不行好像没有其他方法所以我先前没有回答
      

  7.   

    sorry, I misunderstood what you wanted, try something likeFunction getmousehandle() As Long
        Dim  y,  tid, hwnd As Long
        hwnd = GetForegroundWindow()
        tid = GetWindowThreadProcessId(hwnd, y)
        If tid = 0 Then
            getmousehandle = 0
            Exit Function
        End If
        If tid <> GetCurrentThreadId() Then
            y = AttachThreadInput(GetCurrentThreadId(), tid, True)
            hwnd = GetCursor()
            y = AttachThreadInput(GetCurrentThreadId(), tid, False)
        End If
        getmousehandle = hwnd
    End Function
      

  8.   

    楼上的,AttachThreadInput能解释以下吗?你的代码我去调试一下,谢谢你的回复
    如果不行,我继续顶顶顶
      

  9.   

    AttachThreadInput的用法解释:
    通常,系统内的每个线程都有自己的输入队列。本函数(既“连接线程输入函数”)允许线程和进程共享输入队列。连接了线程后,输入焦点、窗口激活、鼠标捕获、键盘状态以及输入队列状态都会进入共享状态