0

Hi,

When i copy the string text first time it copy successfully,When i copy the string text second time i am getting error, why i am getting error i don't know ,Any one help me to resolve this error, I am giving my code below.

        string text;
        OpenClipboard(IntPtr.Zero);
        if (id == 1)
        {
          text= "First time";
        }
        else if (id == 2)
        {
          text= "Second time";
        }


        var ptr = Marshal.StringToHGlobalUni(text);
        SetClipboardData(13, ptr);
        CloseClipboard();
        Marshal.FreeHGlobal(ptr);
karthik
  • 25
  • 4
  • What error are you getting? – reduckted Mar 06 '16 at 10:09
  • 2
    Looks like you're not the only one: http://stackoverflow.com/a/13571530/869621 (see the last comment). Here is a possible explanation: http://stackoverflow.com/a/24698804/869621 – Kevin Gosse Mar 06 '16 at 10:10
  • Thank you for reply all, I am getting this error : An unhandled win32 exception occurred in w3wp.exe [6612]. – karthik Mar 06 '16 at 11:28

0 Answers0