1

I have 2 computer system which is connected to same network (Sys1,Sys2). If I copy any content from Sys1, I need to paste to Sys2.

  • My thought process (.net project)
    • create a application which will run when system start up.
    • when I do copy I have to track, then I will save the copied content to DataBase.
    • while trying to paste (Sys2) I will get the content from Database.

Anyone please suggest, is this one work out? And also please guide to do the Task.

Thanks in advance Ramesh.

Matt Tester
  • 4,663
  • 4
  • 29
  • 32
Ramesh R C
  • 644
  • 7
  • 17

2 Answers2

1

Yes, this approach would work.

Note: consider using existing tools to synchronize content instead of re-inventing the wheel.

Random guess: maybe you are looking for event when something added to clipboard to implemet something similar to clipboard for remote desktop... Check following for info: Clipboard event C#

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • Thanks Alexei, you are given a positive energy for me . but i d't know where to stat. my main problem is how to track Copy process? :( – Ramesh R C May 17 '12 at 04:41
  • It is kind of hard to figure your problems out from the way you've asked question... But it is still unclear what the problem - you know how many items to copy (not sure if content is just files or something else) - so assuming you know how to copy an item it should be easy to know how many items still left to copy... – Alexei Levenkov May 17 '12 at 04:48
  • content may be anything (files,text .. etc).consider an Example: i have one file in my Desktop (TestFile.txt), if i do right on the file the click copy, in the same time i have to call my application for saving the Testfile.txt to database. so my question is how do i know copy option is clicked or not ? – Ramesh R C May 17 '12 at 04:58
  • I'm lost. Please re-read and edit your question to actually contain what you want to ask. Sorry. – Alexei Levenkov May 17 '12 at 05:00
1

You can use MoveFile function to Move file to network location.

File.Copy will not work for UNC path. MoveFile (P/Invoke) will work.

CopyFile does not exist. So First use File.Copy to create a local temp file, then call MoveFile.

c# syntax

[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int MoveFile([In(), MarshalAs(UnmanagedType.LPTStr)] string lpExistingFileName, [In(), MarshalAs(UnmanagedType.LPTStr)] string lpNewFileName);
Tilak
  • 30,108
  • 19
  • 83
  • 131