Results 1 to 6 of 6

Thread: [RESOLVED] download file from google disk with inet or ?

  1. #1

    Thread Starter
    Junior Member hans.grgenstein's Avatar
    Join Date
    Jul 2014
    Location
    Europe, Croatia
    Posts
    18

    Resolved [RESOLVED] download file from google disk with inet or ?

    After much searching the Internet and found www.vbforums.com did not answer my question. The search engine of www.vbforums.com I signed "download file from Google Drive" after seven pages I stopped reading.

    This code works great and I use it if I want to download the file from the website

    Code:
    Option Explicit
    
    Private Sub cmdDownload_Click()
      Screen.MousePointer = vbHourglass
      ProgressBar1.Value = 0
      ProgressBar1.Visible = True 'show progressbar
      'This downloads the file and saves to your machine
      DownloadFile "http://www.somesite.com/somefile.exe", App.Path & "\somefile.exe"
      Screen.MousePointer = vbDefault
      MsgBox "Download Complete"
      ProgressBar1.Visible = False
    End Sub
    
    Private Sub Form_Load()
      Me.Caption = "Sample Downloader With Progress Bar"
      ProgressBar1.Visible = False
    End Sub
    
    Sub DownloadProgress(intPercent As String)
        ProgressBar1.Value = intPercent ' Update file download progress
    End Sub
    
    'Public Function DownloadFile(strURL As String, strDestination As String) As Boolean
    Public Sub DownloadFile(strURL As String, strDestination As String) 'As Boolean
      Const CHUNK_SIZE As Long = 1024
      Dim intFile As Integer
      Dim lngBytesReceived As Long
      Dim lngFileLength As Long
      Dim strHeader As String
      Dim b() As Byte
      Dim i As Integer
    
      DoEvents
      With Inet1
        .URL = strURL
        .Execute , "GET", , "Range: bytes=" & CStr(lngBytesReceived) & "-" & vbCrLf
         While .StillExecuting
            DoEvents
         Wend
    
         strHeader = .GetHeader
      End With
         
      strHeader = Inet1.GetHeader("Content-Length")
      lngFileLength = Val(strHeader)
      DoEvents
      lngBytesReceived = 0
      intFile = FreeFile()
    
      Open strDestination For Binary Access Write As #intFile
        Do
          b = Inet1.GetChunk(CHUNK_SIZE, icByteArray)
          Put #intFile, , b
          lngBytesReceived = lngBytesReceived + UBound(b, 1) + 1
          DownloadProgress (Round((lngBytesReceived / lngFileLength) * 100))
          DoEvents
        Loop While UBound(b, 1) > 0
      Close #intFile
    End Sub
    But if you want to download from the Google Drive you can not with him.
    link for share its:

    https://drive.google.com/file/d/0B9i...ew?usp=sharing

    If someone has time to be a very simple example, I am a beginner in VB6, I was grateful to him for help. Thank you for me and others who know so little like me
    Last edited by hans.grgenstein; May 22nd, 2015 at 04:49 AM. Reason: amendment

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: download file from google disk with inet or ?

    Google Drive does currently offer a client REST API.

    You might successfully implement this on top of the creaky old "Inet control" (Internet Transfer Control) but you will probably have far better luck using any of the modern alternatives, several of which ship as part of Windows now.

    But first look at Authorizing Your App with Google Drive for things you must do even before you get access to the API.

  3. #3

    Thread Starter
    Junior Member hans.grgenstein's Avatar
    Join Date
    Jul 2014
    Location
    Europe, Croatia
    Posts
    18

    Re: download file from google disk with inet or ?

    Quote Originally Posted by dilettante View Post
    Google Drive does currently offer a client REST API.

    ...
    oK,
    We will not bother with iNet , whether opportunities the possibility that vb6 download the file from Google Drive
    Last edited by hans.grgenstein; May 22nd, 2015 at 08:42 AM. Reason: correction

  4. #4

    Thread Starter
    Junior Member hans.grgenstein's Avatar
    Join Date
    Jul 2014
    Location
    Europe, Croatia
    Posts
    18

    Re: download file from google disk with inet or ?

    it seems that it is not possible to do this or not that simple . The only thing left is to buy hosting the site and put the file there .
    I'll put this as resolved because I have not found anywhere on the internet and also I 'm not educated enough to know to find a solution

  5. #5
    Addicted Member
    Join Date
    Jun 2002
    Location
    Finland
    Posts
    169

    Re: [RESOLVED] download file from google disk with inet or ?


  6. #6

    Thread Starter
    Junior Member hans.grgenstein's Avatar
    Join Date
    Jul 2014
    Location
    Europe, Croatia
    Posts
    18

    Re: [RESOLVED] download file from google disk with inet or ?

    thx m8

Tags for this Thread

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