Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=81659 --- shadow/81659 2007-05-17 13:00:47.000000000 -0400 +++ shadow/81659.tmp.28008 2007-05-17 13:00:47.000000000 -0400 @@ -0,0 +1,69 @@ +Bug#: 81659 +Product: Mono: Runtime +Version: 1.1 +OS: +OS Details: Vista +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: interop +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Win32 Interop Issue + +Description of Problem: +The attached code generally fails on SetClipboardData, causing problems for +MWF on Windows. It does not fail on MS.Net 2.0 runtime. My best guess is +an interop bug. + +using System; +using System.Runtime.InteropServices; + +public class HelloWorld +{ + static public void Main () + { + //int CF_TEXT = 1; + int CF_UNICODETEXT = 13; + + Console.WriteLine ("open succeeded: {0}", OpenClipboard (IntPtr.Zero)); + Console.WriteLine ("empty succeeded: {0}", EmptyClipboard ()); + + IntPtr hmem = Marshal.StringToHGlobalUni ("test"); + + Console.WriteLine ("hmem: {0}", hmem.ToString ()); + Console.WriteLine ("set succeeded: {0} ({1})", SetClipboardData +((uint)CF_UNICODETEXT, hmem) != IntPtr.Zero, GetLastError ()); + Console.WriteLine ("close succeeded: {0}", CloseClipboard ()); + } + + [DllImport ("user32.dll")] + private extern static IntPtr SetClipboardData (uint format, IntPtr handle); + [DllImport ("user32.dll")] + private extern static bool OpenClipboard (IntPtr hwnd); + [DllImport ("user32.dll")] + private extern static bool CloseClipboard (); + [DllImport ("user32.dll")] + private extern static bool EmptyClipboard (); + [DllImport ("kernel32.dll")] + private extern static uint GetLastError (); +} + +Actual Results (win/mono 1.2.4, 1.1 and 2.0 profile): +open succeeded: True +empty succeeded: True +hmem: 19459576 +set succeeded: False (0) +close succeeded: True + +Expected Results (.net 2.0): +open succeeded: True +empty succeeded: True +hmem: 2142512 +set succeeded: True (0) +close succeeded: True _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
