1

I have written a c# code to run on a vps, in which I have used Clipboard class. When I am monitoring the vps using vnc-viewer (tight vnc) the Clipboard-based operations fail. But it works fine with team viewer.

I also disabled clipboard transfer option on the vnc viewer, but the problem still existed.

Hamed
  • 1,175
  • 3
  • 20
  • 46

2 Answers2

1

Copy/paste to work add these

  1. sudo apt-get install autocutsel

  2. add this line(autocutsel -fork) in: vi /home/b37399/.vnc/xstartup

    autocutsel -fork

like this

#!/bin/bash
xrdb $HOME/.Xresources
autocutsel -fork
startxfce4 &

restart vncserver

ashish
  • 361
  • 3
  • 8
  • 1
    Thank you. I am using Windows OS. Is there a similar way to fix the problem on Windows? – Hamed Apr 09 '16 at 09:31
0

I have found that various VNC programs are blocking clipboard. This is my solution written in C# for .NET 3.5:

using System.Threading;

   var dataObject = new DataObject();
   private Clipboard()
   {
        //dataObject logic here

        Thread clipboardThread = new Thread(new ThreadStart(GetClipboard));
        clipboardThread.SetApartmentState(ApartmentState.STA);
        clipboardThread.Start();
   }

   private void GetClipboard()
   {
         Clipboard.SetDataObject(dataObject, true, 10, 100);
   }
Sashus
  • 411
  • 7
  • 8