Results 1 to 3 of 3

Thread: How to put this to .NET code?

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    How to put this to .NET code?

    VB Code:
    1. 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
    2. Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    3. Dim lngRetVal As Long
    4. lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    5. If lngRetVal = 0 Then DownloadFile = True
    6. End Function
    7. Private Sub Form_Load()
    8. DownloadFile "http://www.allapi.net", "c:\allapi.htm"
    9. End Sub

    how do i put this to .NET code? i already tryed but it seems to take no effect

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    49
    The problem is just that in .net the long data type has changed. If you want that api call to work just replace where you have used long to use integer. However, you should use the framework classes instead. To achieve the same function just use
    Dim downloadfile As New System.Net.WebClient()
    downloadfile.DownloadFile ("http://www.allapi.net", "C:\allapi.htm")

  3. #3

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ah...i mistaken the API ..there was an API around that if u put the download file it would call that IE prompt message if u want to save the file bla bla bla...is that function that i am looking around...anyone know what is it?

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