You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

wyldechylde

Beginner

  • "wyldechylde" started this thread

Posts: 2

Date of registration: Mar 11th 2010

  • Send private message

1

Sunday, July 11th 2010, 1:00pm

Problem downloading update to application?

Ive currently been updating the application which Ive made using Jabaco by notifying users via email. I dont have a large userbase to my application, however it is steadily growing in the users whom want the java version (I offer it in classic vb6 as well as jabaco)

Currently its used no windows api's as its a simple little thing, but this evening I began trying to implement an update function as I do in vb6 and its racking my brain so Ive decided to seek help.

This is something to the sort of what I would normally use in vb6. Trying to port it into jabaco, it seems that the file dosent download for some reason unknown to me.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Private WinAPI 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

Public Const OurUpdateLocation = "http://www.MyWebsite.Com/CurrentVersion.txt"
Public Const YourDrive = "C:/"
Public Const YourFileName = "CurrentVerion.txt"
Public Const Current Version = "1.0.0"


Public Sub Command1_Click()
If MsgBox("Do you wish to check for updates?", vbYesNo, "Jabaco Update Function") = vbYes Then
 MsgBox "This should take one moment, please be patient."
If Windows Then
 Call URLDownloadToFile 0, OurUpdateLocation, YourDrive & YourFileName , 0, 0
 Else
 MsgBox "Check back with us soon then to keep program current  & bugfree!"
End if
End If
  

End Sub


From there I normally read contents of the text file to see if it matches the constant "Current Version" and if it dosent = "Current Version" then I would download a separate file(the updated program)

Any ideas to what I am doing wrong?

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Sunday, July 11th 2010, 2:44pm

This article might help.

I am wondering if the difference between "C:/" and "C:\" is relevant.
Another problem might be URLDownloadToFileA() vs. URLDownloadToFileW()
Java strings are passed with 2-byte characters.

My advice would be to check the return value of URLDownloadToFile
See here for details.

Try to use a http/network monitoring tool to find out and anlyze the actual network traffic.

An alternative could be to implement the download using java APIs rather than WINAPI calls.
Look at "java.net.URL" and "java.net.HttpURLConnection".

In all cases you have to beware of http proxies. Not every user is directly connected to the Internet.
It might be necessary to connect via a proxy.

Success!

A1880

wyldechylde

Beginner

  • "wyldechylde" started this thread

Posts: 2

Date of registration: Mar 11th 2010

  • Send private message

3

Sunday, July 11th 2010, 2:54pm

I am wondering if the difference between "C:/" and "C:\" is relevant.

Try to use a http/network monitoring tool to find out and anlyze the actual network traffic.

In all cases you have to beware of http proxies. Not every user is directly connected to the Internet.
It might be necessary to connect via a proxy.
A1880
Ah, Im sure the forwardslash/backslash would matter, checking src I actually typed that correctly but did a typo when changing path here for example so that it could be understood what I was doing since I normally use tmp path for update files then another msgbox to check if user wants to move that to current path.

Ill look into downloading via java, thx for the refrences:)

Rate this thread
WoltLab Burning Board