Results 1 to 3 of 3

Thread: getcursorpos

  1. #1

    Thread Starter
    Lively Member wazup guys's Avatar
    Join Date
    Apr 2001
    Location
    in a compressed datastream on the web
    Posts
    114

    getcursorpos

    could someone give me some code dealing with
    bitblt
    setcursorpos
    getcursorpos

    this would help me out alot thanx for any help or ideas
    wahuah

    talk to me about macromedia flash mx, Visual Basic, Vbscript, Html

    [email protected]
    [email protected]
    [email protected]

  2. #2
    Addicted Member killer_cobra's Avatar
    Join Date
    Jun 2001
    Location
    Lost in space
    Posts
    131
    It depends on what you want to do with the cursor. I don't understand what you mean by "bitblt" but if it is for general knowledge then I can help:

    Private Type POINTAPI
    x as Long
    y as Long
    End Type


    Private Declare Function GetCursorPos Lib "User32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long

    Private Declare Function SetCursorPos Lib "User32" Alias "SetCursorPos" (ByVal X As Long, ByVal Y As Long) As Long


    Call them like this in a sub: 'Needs a timer

    Dim z as POINTAPI

    GetCursorPos z

    Edit1 = z.x
    Edit2 = z.y

    ----------------------------------------

    SetCursorPos (###,###) ' x-y coordinates on screen

    Hope this helps....

  3. #3
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Here's a little snip for using BitBlt():
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    4. Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
    5. Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
    6. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    7.  
    8. Private Sub cmdCopy_Click()
    9.    Dim hWndDesktop As Long
    10.    Dim hDCDesktop As Long
    11.    'get desktop's window handle
    12.    hWndDesktop = GetDesktopWindow
    13.    'get desktop's device context
    14.    hDCDesktop = GetWindowDC(hWndDesktop)
    15.    With picDesktop 'picturebox with autoredraw=true, scalemode=3 (pixel)
    16.       .Cls
    17.       'copy a chunk of the desktop image with dimensions
    18.       'of the picturebox
    19.       BitBlt .hDC, 0, 0, .ScaleWidth, .ScaleHeight, hDCDesktop, 0, 0, vbSrcCopy
    20.    End With
    21.    'free the device context
    22.    ReleaseDC hWndDesktop, hDCDesktop
    23. End Sub
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width