|
-
Jul 2nd, 2001, 05:01 PM
#1
Thread Starter
Lively Member
getcursorpos
could someone give me some code dealing with
bitblt
setcursorpos
getcursorpos
this would help me out alot thanx for any help or ideas
-
Jul 2nd, 2001, 07:48 PM
#2
Addicted Member
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....
-
Jul 2nd, 2001, 09:05 PM
#3
Fanatic Member
Here's a little snip for using BitBlt():
VB Code:
Option Explicit
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
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
Private Sub cmdCopy_Click()
Dim hWndDesktop As Long
Dim hDCDesktop As Long
'get desktop's window handle
hWndDesktop = GetDesktopWindow
'get desktop's device context
hDCDesktop = GetWindowDC(hWndDesktop)
With picDesktop 'picturebox with autoredraw=true, scalemode=3 (pixel)
.Cls
'copy a chunk of the desktop image with dimensions
'of the picturebox
BitBlt .hDC, 0, 0, .ScaleWidth, .ScaleHeight, hDCDesktop, 0, 0, vbSrcCopy
End With
'free the device context
ReleaseDC hWndDesktop, hDCDesktop
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|