C'est visual basic qui deconne ou j'ai fait une erreur?

CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 - 18 août 2004 à 20:44
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 - 19 août 2004 à 13:20
slt!
J'ai fai un prog pour envoyer des touches par keybd_event
qui envoi les touche que l'utilisateur entre dans un textbox mais deja les proprietées du textbox sont reduite a 4 proprieté(pas
dans le fenetre proprieté mais dans le code)
alors quand je lance le prog evidement ca plante
QUELQ'UN aurait une reponce
merci
VirusMan :-p

12 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
18 août 2004 à 20:50
Heu, passe ton code, ca sera plus facile je pense pour t'aider, car là, c'est vague !

DarK Sidious

[Responsable API/VB du site www.ProgOtoP.com]
Téléchargez ProgOtoP API Viewer
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
18 août 2004 à 21:48
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Check1_Click()
Check2.Value = Unchecked
txtRepetition.Enabled = True
End Sub

Private Sub Check2_Click()
Check1.Value = Unchecked
txtRepetition.Enabled = False
End Sub

Private Sub cmdArreter_Click()
repetition = txtRepetition + 5
End Sub

Private Sub cmdCommencer_Click()
On Error GoTo erreur
Dim text1 As String
Dim text2 As String
Dim text3 As String
Dim text4 As String
Dim text5 As String
Dim text6 As String
text1 = txtTouche1.Count
text2 = txtTouche2.Count
text3 = txtTouche3.Count
text4 = txtTouche4.Count
text5 = txtTouche5.Count
text6 = txtTouche6.Count
If Check2.Value = Checked Then
Sleep txtDelai.Text
keybd_event text1, 0, 0, 0
keybd_event text1, 0, 2, 0
keybd_event text2, 0, 0, 0
keybd_event text2, 0, 2, 0
keybd_event text3, 0, 0, 0
keybd_event text3, 0, 2, 0
keybd_event text4, 0, 0, 0
keybd_event text4, 0, 2, 0
keybd_event text5, 0, 0, 0
keybd_event text5, 0, 2, 0
keybd_event text6, 0, 0, 0
keybd_event text6, 0, 2, 0
If Option1.Value = True Then
keybd_event 13, 0, 0, 0
keybd_event 13, 0, 2, 0
Else
End If
Else
Dim repetition As String
repetition = "0"
Do While repetition < txtRepetition.Text
repetition = repetition + 1
Sleep txtDelai.Text
keybd_event txtTouche1.Text, 0, 0, 0
keybd_event txtTouche1.Text, 0, 2, 0
keybd_event txtTouche2.Text, 0, 0, 0
keybd_event txtTouche2.Text, 0, 2, 0
keybd_event txtTouche3.Text, 0, 0, 0
keybd_event txtTouche3.Text, 0, 2, 0
keybd_event txtTouche4.Text, 0, 0, 0
keybd_event txtTouche4.Text, 0, 2, 0
keybd_event txtTouche5.Text, 0, 0, 0
keybd_event txtTouche5.Text, 0, 2, 0
keybd_event txtTouche6.Text, 0, 0, 0
keybd_event txtTouche6.Text, 0, 2, 0
If Option1.Value = True Then
keybd_event 13, 0, 0, 0
keybd_event 13, 0, 2, 0
Else
End If
End If
End Sub

Private Sub Form_Load()
MsgBox "Attention,les carractere que vous entrerez dans les textes Touche 1 a 6 ne seront pas pris en compte pour des raison de complexité de code seul leurs nombre(quantité)seront utile(correspondant aux code ascii des touches voulu)exemple pour ! : 11111111111111111111111111111111", vbInformation, "Attention"
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMenu.Show
End Sub

Private Sub txtTouche1_Change(Index As Integer)
lblTouche1.Caption = lblTouche1.Caption & txtTouche1.Count
End Sub

Private Sub txtTouche2_Change(Index As Integer)
lblTouche2.Caption = lblTouche2.Caption & txtTouche2.Count
End Sub

Private Sub txtTouche3_Change(Index As Integer)
lblTouche3.Caption = lblTouche3.Caption & txtTouche3.Count
End Sub

Private Sub txtTouche4_Change(Index As Integer)
lblTouche4.Caption = lblTouche4.Caption & txtTouche4.Count
End Sub

Private Sub txtTouche5_Change(Index As Integer)
lblTouche5.Caption = lblTouche5.Caption & txtTouche5.Count
End Sub

Private Sub txtTouche6_Change(Index As Integer)
lblTouche6.Caption = lblTouche6.Caption & txtTouche6.Count
End Sub

VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
18 août 2004 à 21:50
pour la partie:
Private Sub Form_Load()
MsgBox "Attention,les carractere que vous entrerez dans les textes Touche 1 a 6 ne seront pas pris en compte pour des raison de complexité de code seul leurs nombre(quantité)seront utile(correspondant aux code ascii des touches voulu)exemple pour ! : 11111111111111111111111111111111", vbInformation, "Attention"
End Sub

c'est parceque quand je met .text al a place de .count y a la meme erreur alors j'ai essayer mais de toute facon ca marche pas
VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
18 août 2004 à 22:12
au fait DARKSIDIOUS avant que tu m'ecrive et que je regarde tes sources je n'etait pas croyant mais maintenant j'ai un dieu et c'est toi (c'est une expression ;) )
T'es un surdoué?
t'es source sont balezes et pures!
VirusMan :-p
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
19 août 2004 à 07:19
Lol, je suis loin d'être un surdoué, je suis loin d'être au niveau de certains (qui a dit renfield, brunews, ebArtSoft, Warming, et j'en passe !), mais je m'applique à faire des sources qui reste compréhensible pour tous.
Enfin bref, revenons à nos moutons :
Je te conseille, lorsque tu fait des keybd_event de faire un sleep entre le moment où tu appuie sur la touche et le moment où tu la relâche, pas de beaucoup, 1 ou 2 ms suffisent, mais c'est juste pour être sûr que Windows la prend en compte, car parfois ca ne marche pas (expérience personnelle).

Sinon, est-ce que tes textbox (Text1, Text2, etc.) font partis d'un groupe de textbox ? Car sinon, quel est l'intérêt de récupèrer leur nombre (par la propriété Count), et surtout, de le stocker dans un string ? Là je comprend pas...

Evite aussi les :
Else
End If
Avec rien dans le Else : ca alourdit le code pour rien

Enfin, tu fait un :
Do While repetition < txtRepetition.Text
Mais je ne vois nulle part un Loop pour terminer la boucle normal ?

Dis moi exactement là où le code ne marche pas, ce sera plus facile ;)

DarK Sidious

[Responsable API/VB du site www.ProgOtoP.com]
Téléchargez ProgOtoP API Viewer
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:22
au fait j'avai fait un model de base pour tester l'envoi des touche sauf que lutilisateur ne les choisissaits pas ,ca marxhe meme sans sleep.
quand a count c'etait parce le code marchai pas alors j'essayai une autre methode.
j'ai modifié le code : (l'erreur commence en rouge c'est les lblTouche .caption et les txtTouche.caption qui merde)
ils ont comme proprité dans le code seulement :
count
item
lbound
ubound

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Check1_Click()
Check2.Value = Unchecked
txtRepetition.Enabled = True
End Sub

Private Sub Check2_Click()
Check1.Value = Unchecked
txtRepetition.Enabled = False
End Sub

Private Sub cmdArreter_Click()
repetition = txtRepetition + 5
End Sub

Private Sub cmdCommencer_Click()
On Error GoTo erreur
If Check2.Value = Checked Then
Sleep txtDelai.Text
keybd_event txtTouche1.Text, 0, 0, 0
keybd_event txtTouche1.Text, 0, 2, 0
keybd_event txtTouche2.Text, 0, 0, 0
keybd_event txtTouche2.Text, 0, 2, 0
keybd_event txtTouche3.Text, 0, 0, 0
keybd_event txtTouche3.Text, 0, 2, 0
keybd_event txtTouche4.Text, 0, 0, 0
keybd_event txtTouche4.Text, 0, 2, 0
keybd_event txtTouche5.Text, 0, 0, 0
keybd_event txtTouche5.Text, 0, 2, 0
keybd_event txtTouche6.Text, 0, 0, 0
keybd_event txtTouche6.Text, 0, 2, 0
If Option1.Value = True Then
keybd_event 13, 0, 0, 0
keybd_event 13, 0, 2, 0
End If
Else
Dim repetition As String
repetition = "0"
Do While repetition < txtRepetition.Text
repetition = repetition + 1
Sleep txtDelai.Text
keybd_event txtTouche1.Text, 0, 0, 0
keybd_event txtTouche1.Text, 0, 2, 0
keybd_event txtTouche2.Text, 0, 0, 0
keybd_event txtTouche2.Text, 0, 2, 0
keybd_event txtTouche3.Text, 0, 0, 0
keybd_event txtTouche3.Text, 0, 2, 0
keybd_event txtTouche4.Text, 0, 0, 0
keybd_event txtTouche4.Text, 0, 2, 0
keybd_event txtTouche5.Text, 0, 0, 0
keybd_event txtTouche5.Text, 0, 2, 0
keybd_event txtTouche6.Text, 0, 0, 0
keybd_event txtTouche6.Text, 0, 2, 0
If Option1.Value = True Then
keybd_event 13, 0, 0, 0
keybd_event 13, 0, 2, 0
End If
Loop
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMenu.Show
End Sub

Private Sub txtTouche1_Change(Index As Integer)
lblTouche1.Caption = lblTouche1.Caption & " " & txtTouche1.Text
End Sub

Private Sub txtTouche2_Change(Index As Integer)
lblTouche2.Caption = lblTouche2 & " " & txtTouche2.Text
End Sub

Private Sub txtTouche3_Change(Index As Integer)
lblTouche3.Caption = lblTouche3.Caption & " " & txtTouche3.Text

Private Sub txtTouche4_Change(Index As Integer)
lblTouche4.Caption = lblTouche4.Caption & " " & txtTouche4.Text

Private Sub txtTouche5_Change(Index As Integer)
lblTouche5.Caption = lblTouche5.Caption & " " & txtTouche5.Text
End Sub

Private Sub txtTouche6_Change(Index As Integer)
lblTouche6.Caption = lblTouche6.Caption & " " & txtTouche6.Text
End Sub

VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:24
P.S : c'est tout les .caption qui merde pas seulement 1
VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:33
a oui j'oubliai , y a aussi tout les .text qui marchent
method or data member not found!
VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:33
rectification ...qui marchent pas
VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:37
dark sidious te casse plu la tete c'est vb qui deconne
(j'ai TAPER le MEME CODE sans copier coller sniff ...ca marche!)
VirusMan :-p
0
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
19 août 2004 à 09:39
escuse moi c'est :DarK Sidious

VirusMan :-p
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
19 août 2004 à 13:20
Lol, bon ben je ne t'ai pas beaucoup aidé sur ce coup là alors, mais à la prochaine.

DarK Sidious

[Responsable API/VB du site www.ProgOtoP.com]
Téléchargez ProgOtoP API Viewer
0
Rejoignez-nous