我想在我抓屏的文件中加入鼠标,
我用了以下方法:
Dim cursorpos As POINTAPI
Dim hcur As Long
hcur = GetCursor
Call GetCursorPos(cursorpos)
Call DrawIcon(iDC, cursorpos.x, cursorpos.y, hcur)
注:idc为我的抓屏的缓存
发现鼠标显示的位置不好!!怎么这是怎么回事?

解决方案 »

  1.   

    可能是顶点的问题。鼠标有个HOTSPOT
    需要知道这个HOTSPOT才可以计算出来的。想法不错,佩服。
    不同的光标HOTSPOT不一样
    可能是这个原因
      

  2.   

    这是我抓取鼠标和屏幕的一个过程,效果也还可以Private Sub PrintPhoto()
        Dim hdc As Long
        Dim sw As Integer
        Dim sh As Integer
        Dim CurPos As Pointapi
        Dim Cur As Long
        Me.Hide                    
        DoEvents
        Picture1.AutoRedraw = True
        hdc = GetDC(0)              
        GetCursorPos CurPos  
        Cur = GetCursor   
        Picture1.Width = Screen.Width
        Picture1.Height = Screen.Height
        sw = Screen.Width / Screen.TwipsPerPixelX     
        sh = Screen.Height / Screen.TwipsPerPixelY    
        BitBlt Picture1.hdc, 0, 0, sw, sh, hdc, 0, 0, vbSrcCopy
        Me.Show
        DrawIcon Picture1.hdc, CurPos.x - 10, CurPos.y - 10, Cur 
        ReleaseDC 0, hdc                             
        Picture1.AutoRedraw = False
        SetScrollBar
    End Sub
      

  3.   

    好像还是不行啊!仍然没有鼠标的光标。另外,SetScrollBar这个函数并没有关于它的声明!请指教!谢谢!
      

  4.   

    会不会是写错了点,是这个吗?
    Private Declare Function SetScrollPos Lib "user32.dll" ( _
           ByVal hwnd As Long, _
           ByVal nBar As Long, _
           ByVal nPos As Long, _
           ByVal bRedraw As Long) As Long
      

  5.   

    呵呵~~~不需要SetScrollBar这个,这是我自己写的一个函数,是用来设置滚动栏的,sorry