Click to See Complete Forum and Search --> : urgent!!! y wont this loop work???
Nima Shariatmadari
October 30th, 1998, 12:52 AM
Why wont the do loop at the beggining loop the code it contains/??? i have no clue?? please help!
Private Sub Command1_Click()
Do
Dim intCount As Integer
intCount = 1
Dim X
X = Shell("rundll32.exe rnaui.dll,RnaDial " & Text1.Text, 1)
DoEvents
SendKeys "{enter}", True
DoEvents
Do While ActiveConnection = False
DoEvents
Loop
Dim iret As Long
iret = ShellExecute(Me.hwnd, vbNullString, _
Text2.Text, vbNullString, _
"c:\", SW_SHOWNORMAL)
dwMilliseconds = 30000
Sleep dwMilliseconds
Call HangUp
Loop Until intCount = Text3.Text
Gordito
October 30th, 1998, 08:23 AM
You are declaring variables inside the loop ... this is not good, you cannot declare a variable more than once ... so the second time through (BOOM). You need to declare your variables before the Do loops. You should also initialize your counter OUTSIDE of loop. Also ... I don't see anywhere in the loop where you increment the counter (intCount), it is going to loop forever unless Text3.text = 1. Also... did you declare dwMilliseconds anywhere? Another thing ... You only really need one DoEvents for each Do Loop. The only thing about your post that makes sense is your statement,"i have no clue". Although this may not work how you expect ... it should run.
Private Sub Command1_Click()
Dim intCount As Integer
Dim X
Dim iret As Long
intCount = 1
'Actual Loop
Do
X = Shell("rundll32.exe rnaui.dll,RnaDial " & Text1.Text, 1)
SendKeys "{enter}", True
DoEvents
Do While ActiveConnection = False
DoEvents
Loop
iret = ShellExecute(Me.hwnd, vbNullString, _
Text2.Text, vbNullString, _
"c:\", SW_SHOWNORMAL)
dwMilliseconds = 30000
Sleep dwMilliseconds
Call HangUp
Loop Until intCount = Text3.Text
End Sub
phil
November 10th, 1998, 06:30 PM
not to be a d#ck but that is one UGLY piece of code Nima ! the scary thing is you say you're clueless and you are making shell calls to rundll32... wow ! you should try Visual C++ and do some work with pointers... you win ! ugly code of the year !
phil :)
ps you don't really want an answer to 'y wont this loop work?' do ya ? hehe.
Phil
November 10th, 1998, 06:30 PM
not to be a d#ck but that is one UGLY piece of code Nima ! the scary thing is you say you're clueless and you are making shell calls to rundll32... wow ! you should try Visual C++ and do some work with pointers... you win ! ugly code of the year !
phil :)
ps you don't really want an answer to 'y wont this loop work?' do ya ? hehe.
VBRaZ
December 14th, 2000, 06:11 AM
LOL =)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.