@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The CopyEnhMetaFile API !!!!C# Signature: [DllImport("gdi32.dll")] static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, string lpszFile); !!!!User-Defined Types: None. !!!!Notes: Please note that this API method needs to be called twice! 1st to get the size of the enh meta file and 2nd to fill the buffer. Metafile.GetHenhmetafile() should be called only once on the instance. Subsequent calls result with "Parameter is not valid" error. !!!!Tips & Tricks: Please add some! !!!!Sample Code: public static byte[] GetEnhMetaFileBits(Metafile mf) { ResetLastError(); // sets last error to 0 using [DllImport("kernel32.dll", SetLastError = false)]public static extern int SetLastError(uint dwErrCode); IntPtr hMf = mf.GetHenhmetafile(); uint bufferSize = GetEnhMetaFileBits(hMf, 0, null); // Get required buffer size specifying 0 and NULL. if (bufferSize == 0) { int lastError = Marshal.GetLastWin32Error(); throw new Exception("GetEnhMetaFileBits failed.", new Win32Exception(lastError)); } byte[] buffer = new byte[bufferSize]; if (GetEnhMetaFileBits(hMf, bufferSize, buffer) == 0) // Get raw metafile data. { int lastError = Marshal.GetLastWin32Error(); throw new Exception("GetEnhMetaFileBits failed.", new Win32Exception(lastError)); } return buffer; } [DllImport("gdi32.dll", EntryPoint = "CopyEnhMetaFile", SetLastError = true, CharSet = CharSet.Auto)] private static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, string lpszFile); !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: CopyEnhMetaFile@msdn on MSDN
Edit gdi32.copyenhmeta...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.