Löysin tuolta keskustelun syövereistä kuinka vb:llä matkitaan hiiren napin painamista siellä oli linkki
http://www.geocities.com/SiliconValley/Lakes/
nyt otin ctrl C
ja vb:ssä ctrl V
mutta miksi vb 6 ei kelpaa nämä ja millä ne pitää korvata
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_ABSOLUTE = &H8000
'*** Moduliin Option Explicit Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) _ As Long Declare Function ClientToScreen Lib "user32" (ByVal hwnd As _ Long, lpPoint As POINTAPI) As Long Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _ ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, _ ByVal dwExtraInfo As Long) Public Const MOUSEEVENTF_MOVE = &H1 Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Const MOUSEEVENTF_RIGHTDOWN = &H8 Public Const MOUSEEVENTF_RIGHTUP = &H10 Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 Public Const MOUSEEVENTF_MIDDLEUP = &H40 Public Const MOUSEEVENTF_ABSOLUTE = &H8000 Public Type POINTAPI X As Long Y As Long End Type
-
'***Formiin Private Sub Command1_Click() Dim pt As POINTAPI, curX As Long, curY As Long Dim dstX As Long, dstY As Long ScaleMode = vbPixels pt.X = Command2.Width / 2 pt.Y = Command2.Height / 2 ClientToScreen Command2.hwnd, pt dstX = pt.X * 65535 / ScaleX(Screen.Width, vbTwips, vbPixels) dstY = pt.Y * 65535 / ScaleY(Screen.Height, vbTwips, vbPixels) mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + _ MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, dstX, _ dstY, 0, 0 End Sub Private Sub Command2_Click() MsgBox "Clicked me" End Sub
niin pitäis tomia.
mulla tulee tällainen errori ???
"Public" -määrittelyt pitää olla moduulissa, ei formin declarations -osassa.
Aivan aivan, niin tietysti
Noo ei vain jostain syystä sytyttänyt???
Aihe on jo aika vanha, joten et voi enää vastata siihen.