Rogan Thoerson
Messages postés12Date d'inscriptionjeudi 31 août 2006StatutMembreDernière intervention 5 septembre 2006
-
5 sept. 2006 à 13:09
Rogan Thoerson
Messages postés12Date d'inscriptionjeudi 31 août 2006StatutMembreDernière intervention 5 septembre 2006
-
5 sept. 2006 à 14:01
J'aimerai faire une fonction : Public Function Lecture01(ByVal Texte01 As String, ByVal x As Integer, ByVal y As Integer)
Qui me retourne après exécution les variables x et y. Car la Fonction agit directement sur les valeur de x et y pour reperer une position.
Est ce que c'est possible ?
Comment faire ?
Rogan Thoerson
Messages postés12Date d'inscriptionjeudi 31 août 2006StatutMembreDernière intervention 5 septembre 2006 5 sept. 2006 à 13:27
heum c'est bisard ca marche pas bon je vais te donner le code on verra tout de suite s'il y a un erreur
Private Sub Command1_Click()
Test = Lecture01("
L’effectif, au nombre", 850, 200)
If Test = True Then
Label1.Caption = x
Label2.Caption = y
End If
End Sub
Public Function Lecture01(ByVal Texte01 As String, x As Integer, y As Integer) As Boolean
Dim z As Integer
z = 7
Dim w As Integer
Dim u As Integer
w = x
u = y
rego:
x = w
y = u
Dim Taillestr As Long
Dim Texttest As String
Texttest = ""
Taillestr = Len(Texte01)
While (y < 862) And (Texte01 <> Mid(Texttest, 1, Taillestr))
y = y + z
SetCursorPos x, y
sapiSleep 10
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
sapiSleep 500
SendKeys "^{c}"
DoEvents
Texttest = Clipboard.GetText()
Wend
If (z = 1) And (Texte01 <> Mid(Texttest, 1, Taillestr)) Then
Lecture01 = False
Else
If Texte01 = Mid(Texttest, 1, Taillestr) Then
Lecture01 = True
Else
z = z - 2
GoTo rego
End If
End If
End Function
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 5 sept. 2006 à 13:31
Salut,
Je vais regarder ton code mais sans aller plus loin essaie ceic pour voir si cela ne regle pas ton problème.
Private Sub Command1_Click()
Dim ValX As Integer
Dim ValY As Integer
ValX = 850
ValY = 200
Test = Lecture01(" L'effectif, au nombre", ValX, ValY)
If Test = True Then
Label1.Caption = Valx
Label2.Caption = Valy
End If
End Sub
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 5 sept. 2006 à 13:42
Salut,
En revanche même si cela ne nous dérange pas de t'aider, ce n'est pas à NOUS de perdre du temps a chercher les déclarations d'API et de Constantes
Private Declare Function SetCursorPos Lib "user32" ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub Sleep Lib "kernel32" ByVal dwMilliseconds As Long)
Private 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)
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
De plus ton code hors du reste est inutilisable et non testable .
Qu est ce que les variable cButt et dwEI et que contiennent elles lors de l'appel de Mouse_Event
Rogan Thoerson
Messages postés12Date d'inscriptionjeudi 31 août 2006StatutMembreDernière intervention 5 septembre 2006 5 sept. 2006 à 13:44
ok désoler
'declaration'
Private 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)
Private Declare Function SetCursorPos& Lib "user32" (ByVal x As Long, ByVal y As Long)
Private Declare Sub sapiSleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
'pour utiliser la sourie'
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Const MOUSEEVENTF_WHEEL = &H80
Const MOUSEEVENTF_XDOWN = &H100
Const MOUSEEVENTF_XUP = &H200
Const WHEEL_DELTA = 120
Const XBUTTON1 = &H1
Const XBUTTON2 = &H2
'pour placer le curseur'
Dim x As Long
Dim y As Long
Dim Test As Boolean