Upload file from USB cable to Mobile Device (PC to Mobile)

G

Guest

Hi Guys,

Hope any of you can shed some lights here. I'm currently writing an
application to upload an Excel file from PC to mobile device or from the
device back to PC.

Do I use streamreader/writer to achieve this? Or via other way? I'm using
USB cable to achieve the file transfer. Or I just upload the file to a
location first, and then write a parser to read the data from the uploaded
file?

Thanks.

Regards,
Jenson
 
C

Christian Resma Helle

Hi Jenson,

What you need to do is P/Invoke RAPI functions. I believe a managed API is
provided for this in the Mobile Device Center (Vista). But if you're not
running Vista then here's a perfect resource for you:

How to copy files to a Windows CE-based device by using RAPI from Visual
Basic:
http://support.microsoft.com/kb/307256
 
G

Guest

Hi Christian,

Thanks once again! Finally see you replying my question, it has been a great
help from you. I'll go through them and see what could I do with the sample
code as it's quite long -.-"

I'm almost there to move on to the upload part now.

Thanks.

Regards,
Jenson
 
G

Guest

Hi Chritian,

I supposed it would be similar for VB 2005 too. I'm not so sure as I haven't
really went through the codes in the link yet. At the same time I'm also
looking for sample codes available in Vb 2005.

Thanks.

Regards,
Jenson
 
G

Guest

Hi Christian,

It's a broken link, or I just need to install the latest version of
OpenNetCF? I have installed it before, but I'm not sure whether the RAPI is
included inside or not.

Thanks.

Regards,
Jenson
 
C

Christian Resma Helle

Hi Jenson,

You're right. It seems that the link is broken. I'm sure if we make a
new post regarding the broken link on OpenNETCF then they will fix the
problem immediately. I don't think the managed RAPI wrapper is part of
their smart device framework. It's called the
OpenNETCF.Desktop.Communication Library. It also includes some other
really cool RAPI stuff including the registry related RAPI methods.

Anyway, try posting a new topic regarding the Desktop.Communication
library link being broken, or just email the guys at OpenNETCF
directly. I remember i tried that before and they replied immediately
and effectively.

Regards,
Christian Resma Helle
http://christian-helle.blogspot.com
 
G

Guest

Hi Christian,

I 've downloaded the library now I have to see how to import it in and play
around with it, it seems very powerful and a lot of things can be achieved
with the library, cool!

Regards,
Jenson
 
G

Guest

Hmm, now I have this error after using RAPI support from OpenNetCF, I get the
"Can't find PInvoke DLL 'rapi.dll'." error message during run-time when I
click a button to start the file transfer from my PC to the device through a
USB cable.

Hope any of you would be able to help.

Thanks.

Regards,
Jenson
 
G

Guest

This is what I copied from the error mesasge:

System.MissingMethodException was unhandled
Message="Can't find PInvoke DLL 'rapi.dll'."
StackTrace:
at OpenNETCF.Desktop.Communication.RAPIException..ctor()
at OpenNETCF.Desktop.Communication.ActiveSync..ctor()
at OpenNETCF.Desktop.Communication.RAPI..ctor()
at StockScanDemo.frmGetBlockList.fetchFile()
at StockScanDemo.frmGetBlockList.btnUpload_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at StockScanDemo.frmMain.Main()
 
C

Christian Resma Helle

Hi Jenson,

That's odd. That could mean that you either don't have ActiveSync installed
or you're using a very old version, which both cases I doubt since you
develop mobile solutions.

Try re-installing ActiveSync and see what happens
 
G

Guest

Hi Christian,

Is that a must to have the latest ActiveSync? I'm using ActiveSync 4.2 which
works fine with Windows Mobile 5.0 application development.

I wonder whether it is really the ActiveSync problem, I will try to install
a new one and try. Or do I need to install on the device itself too?

Thanks.

Regards,
Jenson
 
G

Guest

Ok Christian,

I've installed the latest version of ActiveSync, which is 4.5, and the
problem still persists, I just don't know why is it so. Hmm..puzzled.

Regards,
Jenson
 
C

Christian Resma Helle

Hi Jenson,

That's really weird. I honestly don't know why rapi.dll is missing if you
re-installed ActiveSync. It normally comes with it. Maybe you should try to
do a search on your workstation if rapi.dll really is missing.

Anyway, for the sake of moving on, you can just download the rapi.dll itself
from the web. This of course doesn't really solve your problem, but at least
you won't be stuck with it for so long.

I found a link to a rapi.dll in dllbank.com for you:
http://www.dllbank.com/zip/r/rapi.dll.zip

--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com


Jenson said:
Ok Christian,

I've installed the latest version of ActiveSync, which is 4.5, and the
problem still persists, I just don't know why is it so. Hmm..puzzled.

Regards,
Jenson
 
G

Guest

Hi Christian,

From the search I've conducted on the C drive of my PC, it seems that
rapi.dll is there, the location is C:\WINDOWS\system32 I wonder why it is
not loaded.

Regards,
Jenson
 
G

Guest

Am I missing anything in my code? It always points me to my Dim rapiConn as
New OpenNetCT.Desktop.Communication.RAPI, that's weird.

Regards,
Jenson
--
:: Vision is Power ::


Jenson said:
Hi Christian,

From the search I've conducted on the C drive of my PC, it seems that
rapi.dll is there, the location is C:\WINDOWS\system32 I wonder why it is
not loaded.

Regards,
Jenson
 
G

Guest

That's telling you ActiveSync is not installed. RAPI uses ActiveSync as the
underlying transport.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
C

Christian Resma Helle

Hi Jenson,

How does your code look like? Maybe I or the others can take a look at how
you use the library. I'm honestly not that sharp with it since until
recently I would just do the rapi stuff manually.
 

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