Please Help! Downloading updates to Pocket PC 2003 not working!

T

Tim Frawley

I am using the following code to download files to my Windows CE
device running pocket pc 2003.

Private Function Download(ByVal strSource As String, _
ByVal strDestination As String) As Boolean
Cursor.Current = Cursors.WaitCursor
Application.DoEvents()
Dim request As System.Net.WebRequest
Dim response As HttpWebResponse = Nothing
Dim s As Stream = Nothing
Try
request = WebRequest.Create(strSource)
request.Method = "GET"
' read file content
response = request.GetResponse()
s = response.GetResponseStream()
Dim b() As Byte = New Byte(response.ContentLength) {}
s.Read(b, 0, b.Length)

' save file into local storage
If File.Exists(strDestination) Then
File.Delete(strDestination)
End If
Dim fs As Stream = File.OpenWrite(strDestination)
fs.Write(b, 0, b.Length)
fs.Close()

Catch ex As Exception
MsgBox(ex.Message & vbCrLf & vbCrLf & strSource)
Finally
If Not response Is Nothing Then response.Close()
If Not s Is Nothing Then s.Close()
End Try

Cursor.Current = Cursors.Default

End Function

The download works fine and all however when I download a CAB or EXE
file for use on the device the format is unrecognized by the device
and will not run. The exe doesn't execute and the CAB file displays
the following error:

The file "blah.cab" is not a valid Windows CE Setup file.

Any ideas how I can get this to work?
 
S

Simon Hart [MVP]

How are you generating your cab file, what tool? you need to be using the
makecab.exe or VS for PPC/Windows Mobile devices. If you are using the
correct tool, then try naming the .cab .txt, I say this because we had
someone here the other day trying to do something similar although in this
case it was download an .exe or .dll which are of course binary files.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top