Results 1 to 2 of 2

Thread: http downloading

  1. #1

    Thread Starter
    Banned
    Join Date
    Dec 2000
    Location
    USA, NJ
    Posts
    72

    Wink

    I made this little program to be down load files using http. I want to be able to down load any kind of file from *.txt to *.mp3. I can down load smaller files, but on something like a 5 min mp3 it crashes. I think this is because the program is using all the computer memory. I need to the code to use the hard drive like memory. Some one explained that that was what I have to do. But didn't know the code. If you know how to fix this plz post it.
    Thx!

    Note: txt = textbox bnt = button mnu = menu

    code:

    'Declares everything
    Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    "URLDownloadToFileA" (ByVal pCaller As Long, _
    ByVal szURL As String, _
    ByVal szFileName As String, _
    ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) As Long
    'this downloads
    Public Function DownloadFile(URL As String, _
    LocalFilename As String) As Boolean

    Dim lngRetVal As Long

    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)

    If lngRetVal = 0 Then DownloadFile = True

    End Function

    Private Sub bntdl_Click()
    'enter txt for site name
    MsgBox DownloadFile(txtdl.Text, txtto.Text)
    End Sub

    Private Sub bntlocation_Click()
    'to lazy to put the code in agien
    mnudl_Click
    End Sub

    Private Sub bntsave_Click()
    'where to save to
    cdsave.ShowSave
    txtto.Text = cdsave.FileName
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    Select Case MsgBox("Are you sure you want to quit?", vbYesNo)
    Case vbYes
    Unload Me
    End
    Case vbNo

    End Select
    End Sub

    Private Sub mnudl_Click()
    'where to dl from
    txtdl.Text = InputBox("Enter URL")
    End Sub

    Private Sub mnudlfile_Click()
    'where to save
    bntsave_Click
    End Sub

    Private Sub mnuquit_Click()
    'quiting
    Select Case MsgBox("Are you sure you want to quit?", vbYesNo)
    Case vbYes
    Unload Me
    End
    Case vbNo

    End Select
    End Sub

    Private Sub mnuweb_Click()
    bntdl_Click
    End Sub

  2. #2
    Guest
    Text boxes can only hold 65535 characters (or something like that). Do a rich text box because I think that can hold more and it's got more functions to.

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