我也在做类似的程序,附上源代码,望相互切磋! Option Explicit Private Type POINTAPI x As Long y As Long End Type 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 Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Const HWND_TOPMOST = -1Dim tt, nn, mm Private Sub Command1_Click() Static lX As Long, lY As Long On Local Error Resume Next Dim P As POINTAPI, h As Long, hD As Long, r As Long Dim i1, j1, c 'GetCursorPos P P.x = Text1.Text: P.y = Text2.Text lX = P.x: lY = P.y h = WindowFromPoint(lX, lY) 'lblData(1).Caption = h hD = GetDC(h) 'lblData(2).Caption = hD ScreenToClient h, P 'lblData(3).Caption = P.x & "," & P.y For i1 = 0 To 99 For j1 = 0 To 127 r = GetPixel(hD, P.x + j1, P.y + i1) If r = -1 Then BitBlt Picture1(0).hdc, j1, i1, 1, 1, hD, P.x + j1, P.y + i1, vbSrcCopy Else Picture1(0).PSet (j1 * 15, i1 * 15), r End If Next NextEnd SubPrivate Sub Command2_Click() tt = -tt If tt = 1 Then init End SubPrivate Sub Command3_Click() Timer1.Enabled = True End SubPrivate Sub Form_Load() SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Left / Screen.TwipsPerPixelX, Me.Top \ Screen.TwipsPerPixelY, Me.Width \ Screen.TwipsPerPixelX, Me.Height \ Screen.TwipsPerPixelY, 0 tt = -1: mm = -1: nn = 0 Timer1.Enabled = False End SubPrivate Sub Timer1_Timer() Timer1.Enabled = False Command1_Click nn = nn + 1: Label2.Caption = Str(nn) Timer1.Enabled = TrueEnd Sub
[email protected]
给源程序吗?
[email protected]
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
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 Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const HWND_TOPMOST = -1Dim tt, nn, mm
Private Sub Command1_Click()
Static lX As Long, lY As Long
On Local Error Resume Next
Dim P As POINTAPI, h As Long, hD As Long, r As Long
Dim i1, j1, c
'GetCursorPos P
P.x = Text1.Text: P.y = Text2.Text
lX = P.x: lY = P.y
h = WindowFromPoint(lX, lY)
'lblData(1).Caption = h
hD = GetDC(h)
'lblData(2).Caption = hD
ScreenToClient h, P
'lblData(3).Caption = P.x & "," & P.y
For i1 = 0 To 99
For j1 = 0 To 127
r = GetPixel(hD, P.x + j1, P.y + i1)
If r = -1 Then
BitBlt Picture1(0).hdc, j1, i1, 1, 1, hD, P.x + j1, P.y + i1, vbSrcCopy Else
Picture1(0).PSet (j1 * 15, i1 * 15), r
End If
Next
NextEnd SubPrivate Sub Command2_Click()
tt = -tt
If tt = 1 Then init
End SubPrivate Sub Command3_Click()
Timer1.Enabled = True
End SubPrivate Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Left / Screen.TwipsPerPixelX, Me.Top \ Screen.TwipsPerPixelY, Me.Width \ Screen.TwipsPerPixelX, Me.Height \ Screen.TwipsPerPixelY, 0
tt = -1: mm = -1: nn = 0
Timer1.Enabled = False
End SubPrivate Sub Timer1_Timer()
Timer1.Enabled = False
Command1_Click
nn = nn + 1: Label2.Caption = Str(nn)
Timer1.Enabled = TrueEnd Sub
[email protected]
[email protected]
thanks
mailto:[email protected]
thanks a lot.
Is that a winhook program?
[email protected]
E-mail: [email protected]
软件名:自制SPY
作者:snakebird
发布日期:2000-3-7
e-mail: [email protected]
[email protected]
由于软件仍在完善中,代码还要等几天才能发布。
[email protected]
[email protected]
~!~