CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 1998
    Posts
    1

    urgent!!! y wont this loop work???



    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

  2. #2
    Join Date
    Nov 1998
    Posts
    9

    Re: urgent!!! y wont this loop work???



    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



  3. #3
    Join Date
    Mar 1999
    Location
    Roswell, GA
    Posts
    73

    Re: urgent!!! y wont this loop work???



    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.



  4. #4
    Join Date
    Mar 1999
    Location
    Roswell, GA
    Posts
    73

    Re: urgent!!! y wont this loop work???



    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.



  5. #5
    Join Date
    Nov 2000
    Location
    Belgium
    Posts
    11

    Re: urgent!!! y wont this loop work???

    LOL =)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured