Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


FTP file download fails on device


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 11:57 PM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 157
Default FTP file download fails on device

I've written a routine which dowloads files via the FTP library. In order to preserve the ability to update a progress bar during the download, I use the threading library to create a thread which actually downloads the file.

All of this works just fine if compiled for the desktop (optimization is on). However, it fails on the device. I'm getting an error message that an optional resource assembly was not found.

The code for the thread itself is just this simple:
Code:
Sub threadSyncFile_ThreadCode

	ErrorLabel( threadSyncFile_ThreadCodeError )
	
	ftpSyncFile.GetFile( labelSyncFileSource.Text, labelSyncFileTarget.Text )

	syncSetLastDownload( labelSyncFileSource.Text )
	
threadSyncFile_ThreadCodeError:

	labelSyncFileTarget.Text	= ""
	labelSyncFileTarget.Refresh

	Return

End Sub
I've double-checked, and yes, I've got FTPDevice.DLL installed on the device.

The desktop is running Windows XP Pro; the Basic4PPC version is 6.05; the device is an HTC 8925/AT&T Tilt running Windows Mobile 6.

I've beaten my head against a wall too many times already this week; anyone have any ideas, especially why this works on the desktop, but not the device?

Gary

Reply With Quote
  #2 (permalink)  
Old 01-31-2008, 12:12 AM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 157
Default

A little more insight into the problem...

I commented out these two lines and still got the same error:
Code:
'	ftpSyncFile.GetFile( labelSyncFileSource.Text, labelSyncFileTarget.Text )

'	syncSetLastDownload( labelSyncFileSource.Text )
And was able to catch a more robust error message:

Not Supported Exception
An error message cannot be displayed because an optional resource assembly containing it cannot be found

at Microsoft.AGL.Common.MISC.HandleARr()
at System.Windows.Forms.Form.Close
at Dbasic.b4p.ShowError()
at Dbasic.b4p._threadsyncfile_threadcode()
at Dbasic.b4p._threadsyncfile_threadcode()
at Threading.Thread.wrapper()

???

Last edited by willisgt : 01-31-2008 at 12:21 AM.
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 03:52 AM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 157
Default Answered my own question

Answer: threads are not GUI-safe.

Don't try to update anything GUI-related (like the text of a label) from within a thread's code.

Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 12:45 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by willisgt View Post
Don't try to update anything GUI-related (like the text of a label) from within a thread's code.
It's all documented there in the help and in the comments of the example application. That's why thread events are provided. The example porgram shows a thread updating a textbox using a thread event.

Edit :-The missing resource assembly contains the actual error messages that would give a bit more detail about the error. So the original error cannot be displayed triggering a further missing resource error! See this thread error messages on device

Last edited by agraham : 01-31-2008 at 12:51 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking ProgressBar to file download? N1c0_ds Questions & Help Needed 3 11-03-2008 04:57 AM
help with download file Byak@ Questions & Help Needed 2 07-14-2008 07:14 PM
Can I upload and download files from device to PC superbabicka Questions & Help Needed 2 03-31-2008 03:47 PM
Word wrap fails on label control (device only) willisgt Questions & Help Needed 4 11-18-2007 01:46 AM
.sbp file association in the Device Cableguy Code Samples & Tips 8 05-18-2007 03:12 PM


All times are GMT. The time now is 04:09 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0