PRB: ????? ??????? ??? ??????? ??? ????? ?? ???? ???????

?????? ????????? ?????? ?????????
???? ???????: 323530 - ??? ???????? ???? ????? ????? ??? ???????.
???? ??? ??????? ??????? Microsoft .NET Framework ????? ?????? ?????? ???????:
  • System.Drawing.Imaging
  • System.Runtime.InteropServices
????? ???? | ?? ????

???????

????? ??????? ????? ????????? .NET ??? "???????" ??? ????? ??????? ??? ??????? ????.

?????

???? ??? ??????? ????? ??? .NET Framework ?????? ????? ????? ???? ??? ????? ????? ??????? ??? "???????". ????????? ?????? ??? Microsoft Word ?? ???? ??????? ??? ??? ??? ??????? ?????? ? ?????? ?? ???? ??? ?? ??? ??????.

????

?????? ??? ????? ??? "???????" ???? ???? ???????? ???? ??? ?? ?????? ????? CF_ENHMETAFILE. ??? ????? ??? ??? ??????? ?? ???? ????? DataObject ?? ????? DataFormats.EnhancedMetafile. ???? ????? ???? ?? ??????? ?????? ?? ?????? .NET Framework ??? ??? ??? ?? viable. ?????? ??? ?????? ??????? ??????? ???????? ?? Win32 ??????? ?????? ????? ????????? (API) ??? ??? ???????.

????? ????????? ???????? ???? ???? ???? ????? ????? ??? ????? "???" ??????? "???? ???? ???????? ????.

Microsoft Visual Basic .NET ?????

Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices

Public Class ClipboardMetafileHelper
    <DllImport("user32.dll", EntryPoint:="OpenClipboard", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
    End Function
    <DllImport("user32.dll", EntryPoint:="EmptyClipboard", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function EmptyClipboard() As Boolean
    End Function
    <DllImport("user32.dll", EntryPoint:="SetClipboardData", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function SetClipboardData(ByVal uFormat As Integer, ByVal hWnd As IntPtr) As IntPtr
    End Function
    <DllImport("user32.dll", EntryPoint:="CloseClipboard", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function CloseClipboard() As Boolean
    End Function
    <DllImport("gdi32.dll", EntryPoint:="CopyEnhMetaFileA", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function CopyEnhMetaFile(ByVal hemfSrc As IntPtr, ByVal hNULL As IntPtr) As IntPtr
    End Function
    <DllImport("gdi32.dll", EntryPoint:="DeleteEnhMetaFile", _
       SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function DeleteEnhMetaFile(ByVal hemfSrc As IntPtr) As Boolean
    End Function

    ' Metafile mf is set to a state that is not valid inside this function.
    Public Shared Function PutEnhMetafileOnClipboard(ByVal hWnd As IntPtr, ByVal mf As Metafile) As Boolean
        Dim bResult As New Boolean()
        bResult = False
        Dim hEMF, hEMF2 As IntPtr
        hEMF = mf.GetHenhmetafile() ' invalidates mf
        If Not hEMF.Equals(New IntPtr(0)) Then
            hEMF2 = CopyEnhMetaFile(hEMF, New IntPtr(0))
            If Not hEMF2.Equals(New IntPtr(0)) Then
                If OpenClipboard(hWnd) Then
                    If EmptyClipboard() Then
                        Dim hRes As IntPtr
                        hRes = SetClipboardData(14, hEMF2)    ' 14 == CF_ENHMETAFILE
                        bResult = hRes.Equals(hEMF2)
                        CloseClipboard()
                    End If
                End If
            End If
            DeleteEnhMetaFile(hEMF)
        End If
        Return bResult
    End Function

End Class


'You can call this function with code that is similar to the following code:
        Dim mf As New Metafile("filename.emf")
        ClipboardMetafileHelper.PutEnhMetafileOnClipboard(me.Handle,mf)
				

Microsoft Visual C# .NET ?????

using System.Drawing.Imaging;
using System.Runtime.InteropServices;

public class ClipboardMetafileHelper
{
	[DllImport("user32.dll")]
	static extern bool OpenClipboard(IntPtr hWndNewOwner);
	[DllImport("user32.dll")]
	static extern bool EmptyClipboard();
	[DllImport("user32.dll")]
	static extern IntPtr SetClipboardData(uint uFormat, IntPtr hMem);
	[DllImport("user32.dll")]
	static extern bool CloseClipboard();
	[DllImport("gdi32.dll")]
	static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL);
	[DllImport("gdi32.dll")]
	static extern bool DeleteEnhMetaFile(IntPtr hemf);
	
	// Metafile mf is set to a state that is not valid inside this function.
	static public bool PutEnhMetafileOnClipboard( IntPtr hWnd, Metafile mf )
	{
		bool bResult = false;
		IntPtr hEMF, hEMF2;
		hEMF = mf.GetHenhmetafile(); // invalidates mf
		if( ! hEMF.Equals( new IntPtr(0) ) )
		{
			hEMF2 = CopyEnhMetaFile( hEMF, new IntPtr(0) );
			if( ! hEMF2.Equals( new IntPtr(0) ) )
			{
				if( OpenClipboard( hWnd ) )
				{
					if( EmptyClipboard() )
					{
						IntPtr hRes = SetClipboardData( 14 /*CF_ENHMETAFILE*/, hEMF2 );
						bResult = hRes.Equals( hEMF2 );
						CloseClipboard();
					}
				}
			}
			DeleteEnhMetaFile( hEMF );
		}
		return bResult;
	}
}

//You can call this function with code that is similar to the following code:
Metafile mf = new Metafile( "filename.emf" );
ClipboardMetafileHelper.PutEnhMetafileOnClipboard(this.Handle, mf );
				

???????

???? ???????: 323530 - ????? ??? ??????: 10/???? ??????/1427 - ??????: 3.2
????? ???
  • Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
  • Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
  • Microsoft Windows XP Professional
  • the operating system: Microsoft Windows XP 64-Bit Edition
????? ??????: 
kbmt kbdswgdi2003swept kbprb KB323530 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????323530

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com