词条 | vb屏幕放大器 |
释义 | 模仿WIN自带的放大器,用了几个很简单的API,适合API初学者! 功能: 1.屏幕顶层窗口 2.抓坐标 3.场景 '--------新建form粘贴以下所有代码,加一个Timer1------------ Option Explicit Private Type POINTAPI x As Long y As Long End Type Const Srccopy = &HCC0020 Const Swp_nomove = &H2 Const Swp_nosize = &H1 Const Flags = Swp_nomove Or Swp_nosize Const hwnd_topmost = -1 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 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 StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long Dim pos As POINTAPI Private Sub Form_Load() Me.Left = 0 Me.Top = 0 Me.Height = 3330 Me.Width = 3090 SetWindowPos hwnd, hwnd_topmost, 0, 0, 0, 0, Flags End Sub Private Sub start() Dim sx As Integer Dim sy As Integer GetCursorPos pos sx = IIf(pos.x < 50 Or pos.x > 590, IIf(pos.x < 50, 0, 540), pos.x - 50) sy = IIf(pos.y < 50 Or pos.y > 430, IIf(pos.y < 50, 0, 380), pos.y - 50) Caption = "坐标" & sx & "," & sy & " Wlclass" StretchBlt hdc, 0, 0, 200, 200, GetDC(0), sx, sy, 100, 100, Srccopy End Sub Private Sub Timer1_Timer() start End Sub |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。