473,327 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

trying to transfer files to a PDA

Hi-

I'm trying to transfer files directly to a PDA via a Csharp program
I'm writing. Does anyone know how to do this (I obviously can't use
active sync).

Ohh yes, I'm running Vista.

-Thanks

-Dan

Jul 25 '07 #1
4 8243
Dan,

Why can't you use Active Sync? Is it because the PDA doesn't support
it? If this is the case, then you will most likely have to use an SDK for
the specific product.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Da***********@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
Hi-

I'm trying to transfer files directly to a PDA via a Csharp program
I'm writing. Does anyone know how to do this (I obviously can't use
active sync).

Ohh yes, I'm running Vista.

-Thanks

-Dan

Jul 25 '07 #2
On Jul 25, 8:46 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Dan,

Why can't you use Active Sync? Is it because the PDA doesn't support
it? If this is the case, then you will most likely have to use an SDK for
the specific product.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<DanielGiff...@gmail.comwrote in message

news:11**********************@x40g2000prg.googlegr oups.com...
Hi-
I'm trying to transfer files directly to a PDA via a Csharp program
I'm writing. Does anyone know how to do this (I obviously can't use
active sync).
Ohh yes, I'm running Vista.
-Thanks
-Dan- Hide quoted text -

- Show quoted text -
I can't use active sync becasue I'm trying to transfer over files to
places that active sync won't let me. I need to do this via my
program. Also, activesync doesn't exactly exist for vista (though
there is a new program that basically does the same thing).

Jul 25 '07 #3
Hi,

Yes, of course, you have to use RAPI.

Here is the code to copy a file

public static void CopyFileToPDA(string localfile, string remotefile)
{
//First Copy the executable
int fileh= RAPI.CeCreateFile(remotefile, RAPI.GENERIC_WRITE, 0, 0,
RAPI.CREATE_ALWAYS, RAPI.FILE_ATTRIBUTE_NORMAL, 0);
if ( fileh == 0)
throw new Exception("Error Creating Remote File : " );
FileStream reader = new FileStream(localfile,FileMode.Open);
byte[] buff = new Byte[ 400096];
int readed = 0;
int written=0;
while( (readed=reader.Read( buff, 0, 400096))>0)
RAPI.CeWriteFile( fileh, buff, readed, out written, 0);
RAPI.CeCloseHandle( fileh);
reader.Close();

}

public static void RapiInit()
{
try
{
if ( !isRAPIOpen)
CeRapiInit ();
isRAPIOpen = true;
}
catch(Exception e)
{
isRAPIOpen = false;
}
}
public static void RapiUninit ()
{
if ( isRAPIOpen )
CeRapiUninit();
isRAPIOpen = false;
}

These are the p/invoke that you need.

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeDeleteFile(string remotefile);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeCloseHandle(int hObject);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeCreateFile(string lpFileName,uint
dwDesiredAccess,int dwShareMode,int lpSecurityAttributes,int
dwCreationDisposition,int dwFlagsAndAttributes,int hTemplateFile);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeRapiInitEx ([MarshalAs(UnmanagedType.Struct)]
ref RAPIINIT pRapiInit);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
protected static extern int CeRapiInit ();

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
protected static extern int CeRapiUninit ();

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeReadFile(int hFile,byte[] lpBuffer,int
nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeWriteFile(int hFile,byte[] buffer, int
nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeGetLastError();

<Da***********@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
Hi-

I'm trying to transfer files directly to a PDA via a Csharp program
I'm writing. Does anyone know how to do this (I obviously can't use
active sync).

Ohh yes, I'm running Vista.

-Thanks

-Dan

Jul 25 '07 #4
Hi,

<Da***********@gmail.comwrote in message
news:11**********************@z28g2000prd.googlegr oups.com...
On Jul 25, 8:46 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Dan,

Why can't you use Active Sync? Is it because the PDA doesn't support
it? If this is the case, then you will most likely have to use an SDK
for
the specific product.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<DanielGiff...@gmail.comwrote in message

news:11**********************@x40g2000prg.googleg roups.com...
Hi-
I'm trying to transfer files directly to a PDA via a Csharp program
I'm writing. Does anyone know how to do this (I obviously can't use
active sync).
Ohh yes, I'm running Vista.
-Thanks
-Dan- Hide quoted text -

- Show quoted text -

I can't use active sync becasue I'm trying to transfer over files to
places that active sync won't let me. I need to do this via my
program. Also, activesync doesn't exactly exist for vista (though
there is a new program that basically does the same thing).
I personally have never used ActiveSync, I use RAPI, if you go to
opennetcf.org you will see an extensive list of libraries you can use to
develop apps for PPC
Jul 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Danny | last post by:
Hi all, I am using the Internet Data Transfer Library to ftp files to another server: http://www.mvps.org/access/modules/mdl0037.htm it works fine ftping to another server, but I cannot ftp...
4
by: Weston Weems | last post by:
I've got the simple problem where I'd like to transfer somewhat large files to my webserver via http/webservice/something like that. My question is what kinda limits have people been able to...
1
by: henrycortezwu | last post by:
Hi All, I'd like to transfer files from a Desktop computer to my Cellphone/PDA using VB.NET I've research a bit on this, and I found that I would need to do it using OBEX via Serial Bluetooth...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
11
by: E.T. Grey | last post by:
Hi, I have an interesting problem. I have a (LARGE) set of historical data that I want to keep on a central server, as several separate files. I want a client process to be able to request the...
1
by: maz01 | last post by:
Hello All, I am developing an application in visual basic 2005 that will run continuously in the background on a users workstation. This application will automatically transfer files from the...
2
yashg
by: yashg | last post by:
I am building a data backup application in C# using Sockets. It has a server component and a client component. The client is going to upload files to the server through TCP sockets. I've got all...
0
by: vasikaran | last post by:
Hi , i hava one ftp script in batch file programming , ftp script is working fine.. but my is i dont know how much files and what are files avaiulable in remote folder ,,,, if any errors or...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.