OpenNETCF.Desktop.Communication.dllを使用したRAPIコピーファイル
質問
私は現在OpenNETCF.Desktop.Communication.dllを使用してデスクトップからCEデバイスにファイルをコピーしていますが、エラーが発生し続けています:
‘リモートファイルを作成できませんでした’
私の開発環境はVS2005(VB.NET)です
マイコード:
ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.txt", "\results.txt")
ObjRapi.Dispose()
ObjRapi.Disconnect()
これに遭遇した人はいますか?
ありがとう
解決
以前に一度これに遭遇したことがありますが、何が原因であったかを本当に思い出すことはできません。
あなたのコードを見ることで考えることができるのは、次の行だけです:
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に設定すると機能する場合があります。
他のヒント
これを試してください
新しいRAPIとしての薄暗いmyrapi
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
次のコードを使用する必要があります:
op.CopyFileToDevice(@"C:\results.txt", @"\Temp\results.txt");
コードでは、ファイルのコピー先のパスに言及していません。
これがお役に立てば幸いです。
所属していません StackOverflow