使用 OpenNETCF.Desktop.Communication.dll 的 RAPI 复制文件

发布于 2024-07-08 19:37:17 字数 331 浏览 14 评论 0原文

我目前正在使用 OpenNETCF.Desktop.Communication.dll 将文件从桌面复制到 CE 设备,但我不断收到错误:

“无法创建远程文件”

我的开发环境是 VS2005 (VB.NET)

我的代码:

ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.txt", "\results.txt")
ObjRapi.Dispose()
ObjRapi.Disconnect()

有没有人遇到过这个问题,你是否设法解决了这个问题?

谢谢

I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:

‘Could not create remote file’

My development environment is VS2005 (VB.NET)

My code:

ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.txt", "\results.txt")
ObjRapi.Dispose()
ObjRapi.Disconnect()

Has anyone run into this and did you manage to get around it.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

_蜘蛛 2024-07-15 19:37:17

我以前遇到过一次这种情况,但我不太记得是什么原因造成的。

通过查看您的代码,我唯一能想到的是这一行:

ObjRapi.CopyFileToDevice("C:\results.txt", "\ \results.txt") 

我不确定,但您可以尝试将目标路径更改为不同的路径。 像这样的事情:

ObjRapi.CopyFileToDevice("C:\results.txt", "\My Documents\results.txt")

我现在无法真正测试这个,但我真的不明白为什么它不起作用。

编辑:我刚刚看了一些我使用 RAPI 编写的代码,当我复制我的行时,它看起来像这样:

ObjRapi.CopyFileToDevice("C:\results.txt", "\My Documents\results.txt",True)

最后的布尔值是一个覆盖开关,将其设置为 true 可能会起作用。

I have run into this once before but I can't really remember what was causing it.

The only thing I can think of from looking at your code is this line:

ObjRapi.CopyFileToDevice("C:\results.txt", "\ \results.txt") 

I'm not sure but you could try and change the destination path to something different. Something like this:

ObjRapi.CopyFileToDevice("C:\results.txt", "\My Documents\results.txt")

I can't really test this at the moment but I really don't see why it wouldn't work.

EDIT: I just had a look at some code that I have writen using the RAPI,when I do any copying my line looks like this:

ObjRapi.CopyFileToDevice("C:\results.txt", "\My Documents\results.txt",True)

The boolean on the end is an overwrite switch, setting that to true may work.

故人的歌 2024-07-15 19:37:17

试试这个

Dim myrapi As New RAPI

        If myrapi.DevicePresent = True Then
            myrapi.Connect()

            If myrapi.Connected = True Then
                Windows.Forms.Cursor.Current = Cursors.WaitCursor
                If myrapi.DeviceFileExists("\Backup\stock.txt") Then
                    myrapi.CopyFileFromDevice(Application.StartupPath 

                Windows.Forms.Cursor.Current = Cursors.Default
                MessageBox.Show("File Copied Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)

            Else
                MessageBox.Show("Please Connect to the Mobile Device", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
            End If

        Else
            MessageBox.Show("Please Connect to the Mobile Device", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
        End If

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

try this

Dim myrapi As New RAPI

        If myrapi.DevicePresent = True Then
            myrapi.Connect()

            If myrapi.Connected = True Then
                Windows.Forms.Cursor.Current = Cursors.WaitCursor
                If myrapi.DeviceFileExists("\Backup\stock.txt") Then
                    myrapi.CopyFileFromDevice(Application.StartupPath 

                Windows.Forms.Cursor.Current = Cursors.Default
                MessageBox.Show("File Copied Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)

            Else
                MessageBox.Show("Please Connect to the Mobile Device", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
            End If

        Else
            MessageBox.Show("Please Connect to the Mobile Device", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
        End If

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
も星光 2024-07-15 19:37:17

您必须使用以下代码:

op.CopyFileToDevice(@"C:\results.txt", @"\Temp\results.txt");

在您的代码中,您没有提及要复制文件的路径。

希望对你有帮助。

You have to use the following code:

op.CopyFileToDevice(@"C:\results.txt", @"\Temp\results.txt");

In your code you are not mentioning the path where you want to copy the file.

Hope this will help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文