1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| Public Sys As Object, Sess As Object
'Fonction de mise en premier plan de l'application Extra!
Function LanceTGC() As Boolean
On Error GoTo ERR_XTRA
Set Sys = CreateObject( "EXTRA.System" ): Set Sess = Sys.ActiveSession
TestTGC = False
If Sys Is Nothing Then
MsgBox "Echec lors du lancement de l'émulateur", vbCritical, "- Erreur logiciel -"
End
End If
If Sess Is Nothing Then
MsgBox "Echec lors de la récupération de la session", vbCritical, "- Erreur logiciel -"
End
End if
Sess.WindowState = 0: Sess.WindowState = 1: TestTGC = True
Exit Function
ERR_XTRA:
MsgBox "Le logiciel EXTRA! Personal Client n'est pas installé.", vbCritical, "Erreur ActivX"
End Function
'Fonction de temporisation (ehh oui parfois ca va trop vite !! :mouarf:)
Sub WaitTGC()
Do While Sess.Screen.OIA.XStatus = 5: Loop
End Sub
'Fonction de déplacement du curseur
Sub Move(ByVal lig%, ByVal col%)
With Sess.Screen
.MoveTo lig, col
If (.Row <> lig And .col <> col) Then .WaitForCursor lig, col
End With
End Sub
'Fonction de saisie dans l'application
Sub PutS(chaine$, ByVal lig%, ByVal col%)
Call Move(lig, col)
With Sess.Screen
.PutString chaine
End With
Call WaitTGC
End Sub
'Fonction de récupération de valeur de l'application
Function GetS(ByVal x%, ByVal y%, ByVal l%) As String
Dim ret$
With Sess.Screen
ret = .GetString(y, x, l)
End With
Call WaitTGC
GetS = ret
End Function
'Fonction de simulation de saisie clavier
Sub Comm(com$, Optional ByVal lig% = -1, Optional ByVal col% = -1)
With Sess.Screen
If x <> -1 And y <> -1 Then Call Move(lig, col)
.SendKeys ("<" & com & ">")
End With
Call WaitTGC
End Sub
'Fonction de recherche de valeur dans l'application
Function Search(Info$) As Boolean
Dim Area As Object
Search = False
With Sess.Screen
Call Move(1, 1)
Set Area = .Search(Info)
.MoveTo Area.Bottom, Area.Right
If Area.Bottom > 1 Or Area.Right > 1 Then Search = True
End With
End Function |
Partager