Hi!
Ich lese mit folgendem Quellcode die Mauskoordinaten aus und zeichne Pixel auf die UserForm. Trotzdem werden die Punkte versetzt gezeichnet, wo liegt mein Fehler?
Vielen Dank für Eure Hilfe! MfG, Andi
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub UserForm\_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim hWnd As Long
Dim hDC As Long
Dim PT As POINTAPI
hWnd = FindWindow(vbNullString, Me.Caption)
hDC = GetDC(hWnd)
GetCursorPos PT
SetPixel hDC, PT.X + KorrekturX, PT.Y + KorrekturY, vbBlack
End Sub
[MOD] Pre-Tags eingefügt