在Form1的Keypress事件编写代码,实现按下"S"键时,调用API函数GetCursorpos,
在文件显示当前鼠标的位置

解决方案 »

  1.   

    private type POINTAPI
         x as long
         y as long
    end typeprivate sub form_keypress(... )
    if keyascii = asc( "s" ) then
    dim p as pointapi
    getcursorpos p
    textout p.x, p.y, cstr( p.x ) & "  " & cstr( p.y ), 30
    end if
    end sub
      

  2.   

    private type POINTAPI
         x as long
         y as long
    end typeprivate sub form_keypress(... )
    if keyascii = asc( "s" ) then
    dim p as pointapi
    getcursorpos p
    textout me.hdc, p.x, p.y, cstr( p.x ) & "  " & cstr( p.y ), 30
    end if
    end sub