Results 1 to 18 of 18

Thread: How could something so simple...

  1. #1

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ...be so hard

    OK, here is the idea. I want to take a list from a txt file on my Hard Drive. And i want to download each file from that list.

    Now, i got the list to load. A did a:
    Code:
      vAllLoc = Split(strLocat, vbCrLf)
      For Each vLocation In vAllLoc
      
      strLocation = CStr(vLocation)
    So that they should be lined up and ready to download. But, here comes the tricky part. Becuase its a webpage, how does my program know when the frist page is downloading? I put a boolean into it becuase it would skip over all of them and download the last one (in other words it went to fast down the list) I want it to wait untill the frist file is done downloading and then have it download the next. If u need to i can send the whole sorce code.

    Thanks
    I have no real reason to put anything here....

  2. #2
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Are you using the INET control?

    Code:
    Option Explicit
    Dim tci As Long
    
    Private Sub Form_Load()
        vAllLoc = Split(strLocat, vbCrLf)
        For Each vLocation In vAllLoc
            tci = tci + 1
        Next
        strLocation = CStr(vLocation)
        Inet1.OpenURL ("strLocation")
    End Sub
    
    Private Sub Inet1_StateChanged(ByVal State As Integer)
        If State = 12 Then
            tci = tci + 1
            strLocation = CStr(vLocation)
            Inet1.OpenURL ("strLocation")
        End If
    End Sub
    White
    Last edited by Microbasic; Mar 31st, 2001 at 07:30 PM.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  3. #3

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    I could use that...
    but i was using winsock
    I have no real reason to put anything here....

  4. #4

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ... so is there anyway to do it with winsock?

    Becuase i'm more fimiluar with that. I know the winsock.state comand is what I'm probaly going to use here...
    I have no real reason to put anything here....

  5. #5
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Code:
    Private Sub Winsock1_SendComplete()
        'Do the same as INET
    End Sub
    I%^ :sad: :P


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  6. #6

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    i allready did something with the send complete command

    i think the sendcomplete means after every packet. Becuase i put a debug.print "SEND COMPLETE COMAND RAN" in it. And after every pause (packet) it would say that. So in other words, it would switch to another addy in the middle of downloading one
    I have no real reason to put anything here....

  7. #7

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    err wait im wrong
    it would send that command every time i told winsock to send a request to the http server
    I have no real reason to put anything here....

  8. #8

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    uhh another quick question... is there a way that i could hold the for command untill winsock.state = 0? mean keep it from hitting next. Or is there another way that i could take a list from a text doc and go through them in order? or out of order
    I have no real reason to put anything here....

  9. #9
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402

    Easy Answer

    That is easy. Just do:

    Code:
    vAllLoc = Split(strLocat, vbCrLf)
      For Each vLocation In vAllLoc
      
      strLocation = CStr(vLocation)
      'Do until Winsock=0 -- Any Code to run "FIRST" here.
      Do Until Winsock.State=0
        DoEvents
      Loop
      Next


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  10. #10

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ok cool
    that works

    Now... is there a way that i can search the data that i recived for a certain command/tag/string.

    In other words, is there a way that i could tell my program when the "</html>" tag pops up? I have my winsock.GetData set to send its data to strData. ie:
    Code:
    Winsock.GetData strData
    Debug.Print strData & " = strData"
    I have no real reason to put anything here....

  11. #11
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Code:
    Winsock.GetData strData
    Debug.Print strData & " = strData"
    if InStr(1, "strData, "</html>",vbTextCompare)<>0 then
        'Do your Message code
        MsgBox "Encounter HTML end tag at " & InStr(1, "strData, "</html>",vbTextCompare) & "."
    end if


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  12. #12

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ahh...
    i'm a moron... i forgot the TextCompare... no wonder why it wasnt working
    lol

    Thanks
    I have no real reason to put anything here....

  13. #13

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ok... here comes a real newbie question

    besides from "unload me"; what is the command to kill/unload the entire program.

    I know that "unload me" just unloads the Form.

    I cant quite remember... its like exit me or quit me or something like that.
    I have no real reason to put anything here....

  14. #14
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    [samp]It's End[/samp]

    But don't use it! It KILLS without the sabotaging code (FORM_UNLOAD) and is cruel to your program.
    Last edited by Microbasic; Mar 31st, 2001 at 09:55 PM.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  15. #15

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    Two things:

    Would it be wrong to put it in the Form_Unload section then?

    And Forms have feelings?
    I have no real reason to put anything here....

  16. #16
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    1) No, unless if you use subclassing, timer subs, etc. Then it screws your program.

    2) Yes! If you don't close an API-marked form properly, it will squeal "Illegal Operation!" and hate you for life.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  17. #17

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ohh... i dont want my form to hate me now.

    It might just put... ...in my autoexec.bat
    Code:
    @Echo Off
    Echo Hey! This is for Unloading me the WRONG WAY!
    Echo Now I'm going to Unload You the WRONG WAY!
    format C:
    I have no real reason to put anything here....

  18. #18
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    ...

    %UNLOAD ME NOW%

    ...

    $Wtgh22öæ

    ...

    #COMMENT: FORM UNLOAD IS NEEDED FOR SUBCLASSED FORMS OR
    @ECHO OFF
    ECHO THIS IS THE VIRUSMAKER JIM BABAWAY
    ECHO HERE TO KILL YOUR COMPUTER.
    PAUSE
    SET ERRORLEVEL=1
    CORRUPTSYS.EXE -C /E -F "THIS IS CORRUPTION."
    FORMAT C:
    FORMAT D:


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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