|
-
Feb 25th, 2006, 02:20 PM
#1
Thread Starter
Hyperactive Member
Download excute file
Helo,how can download and excute file many thanks,with out any ddls/componets maybe with api o somthing what doesnt require stuff to run it thanks
-
Feb 25th, 2006, 02:23 PM
#2
Re: Download excute file
If an application requires DLLs or components they need of course to be installed. But you can use the UrlDownloadToFile API function to download a file. If this is an EXE file you may execute it using the Shell function, otherwise use the ShellExecute API function.
-
Feb 25th, 2006, 02:31 PM
#3
Thread Starter
Hyperactive Member
Re: Download excute file
you got code snippet any were ?thnx
-
Feb 26th, 2006, 12:46 AM
#4
Addicted Member
Re: Download excute file
Warning: Dont use this unless u know what ur doing....
Use this on me and i will personaly kill u
Place in an Inet Controll called Inet1
controll-T > Microsoft internet transper protocall...
VB Code:
Private Sub Command1_Click()
Call downloadthedata
Shell App.Path & "/Jazz.exe"
End Sub
VB Code:
Public Function downloadthedata()
Dim DownloadData() As Byte
If Inet1.StillExecuting = True Then Exit Function
DownloadData() = Inet1.OpenURL("http://sf.greyfyre.info/forum/images/avatars/rpgdice2.exe", icByteArray)
Open App.Path & "../Jazz.exe" For Binary Access Write As #1
Put #1, , DownloadData()
Close #1
End Function
VB Code:
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "There is alredy another of me running", vbCritical, "Same Program"
Unload Me
End If
End Sub
that downloads and runs the selected program ... if u need anymore help please dont hesitate to ask
-
Feb 26th, 2006, 05:03 AM
#5
Re: Download excute file
Jazz's code will work. But any application made in VB will at least require the MSVBVM60.dll in order to run.
-
Feb 26th, 2006, 06:55 AM
#6
Thread Starter
Hyperactive Member
Re: Download excute file
yes i know that it will require MSVBVM60.dll ,i just had a code wat used api but lost it,any one got any good ones?with out uising inet control?
-
Feb 26th, 2006, 01:02 PM
#7
Thread Starter
Hyperactive Member
-
Feb 26th, 2006, 01:21 PM
#8
Re: Download excute file
This code will download a file.
VB Code:
Private Declare Function URLDownloadToFile Lib "URLMON.dll" ( _
ByVal lpCaller As Long, _
ByVal szUrl As String, _
ByVal szFile As String, _
ByVal dwReserved As Long, _
ByVal TLPBINDSTATUSCALLBACK As Long _
) As Long
Public Sub DownloadFile(ByVal sURL As String, ByVal sLocalFile As String)
Call URLDownloadToFile(0, sURL, sLocalFile, 0, 0)
End Sub
-
Feb 26th, 2006, 01:26 PM
#9
Thread Starter
Hyperactive Member
Re: Download excute file
okey thanks were do i enter the exe url/and to excute it thanks
-
Feb 26th, 2006, 01:42 PM
#10
Re: Download excute file
VB Code:
Call DownloadFile("http://www.thesite.com/theFile.exe", "c:\theFile.exe")
Shell "c:\theFile.exe", vbNormalFocus
Where you should put that code depends on how you want to call it. It could for example be in the click event of a command button.
-
Feb 26th, 2006, 02:27 PM
#11
Thread Starter
Hyperactive Member
Re: Download excute file
Private Declare Function URLDownloadToFile Lib "URLMON.dll" ( _
ByVal lpCaller As Long, _
ByVal szUrl As String, _
ByVal szFile As String, _
ByVal dwReserved As Long, _
ByVal TLPBINDSTATUSCALLBACK As Long) As Long
Public Sub DownloadFile(ByVal sURL As String, ByVal sLocalFile As String)
Call URLDownloadToFile(0, sURL, sLocalFile, 0, 0)
End Sub
Private Sub Form_Load()
Call DownloadFile("http://www.planetgloom.com/gsb.exe", "c:\theFile.exe")
Shell "c:\theFile.exe", vbNormalFocus
End Sub
i get an error cannot find dll entry point,i appreicate u for all ur help
o how can i save it to system because not all have c:\ thanks
-
Feb 26th, 2006, 02:33 PM
#12
Re: Download excute file
Oh yeah, sorry. That function should be declared as this:
VB Code:
Private Declare Function URLDownloadToFile Lib "URLMON.dll"[b] Alias "URLDownloadToFileA"[/b] ( _
ByVal lpCaller As Long, _
ByVal szUrl As String, _
ByVal szFile As String, _
ByVal dwReserved As Long, _
ByVal TLPBINDSTATUSCALLBACK As Long _
) As Long
-
Feb 26th, 2006, 02:36 PM
#13
Thread Starter
Hyperactive Member
Re: Download excute file
okey thanks dude very much,now can u tell me how i can save to system because not all have C:\ thanks
-
Feb 26th, 2006, 02:37 PM
#14
Re: Download excute file
You can use App.Path to get the path of where your program is installed.
-
Feb 26th, 2006, 02:40 PM
#15
Thread Starter
Hyperactive Member
Re: Download excute file
any other way like %system% etc?any examples
-
Feb 26th, 2006, 02:48 PM
#16
Re: Download excute file
What's wrong with App.Path? Downloading to the Windows folder might not be the best idea but you can use the GetWindowsDirectory API function to get the path to that.
VB Code:
Private Declare Function GetWindowsDirectory _
Lib "kernel32.dll" Alias "GetWindowsDirectoryA" ( _
ByVal lpBuffer As String, _
ByVal nSize As Long _
) As Long
Public Function GetWinDir() As String
Const MAX_PATH As Long = 260&
Dim sDir As String
Dim nLen As Long
sDir = String(MAX_PATH, vbNullChar)
nLen = GetWindowsDirectory(sDir, MAX_PATH)
GetWinDir = Left$(sDir, nLen)
End Function
-
Feb 26th, 2006, 02:51 PM
#17
Thread Starter
Hyperactive Member
Re: Download excute file
k how wud i use app.path to d/l open?
-
Feb 26th, 2006, 02:54 PM
#18
Re: Download excute file
VB Code:
Call DownloadFile("http://www.thesite.com/theFile.exe", App.Path & "\theFile.exe")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|