void CMyView::OnEditCopyWmf()
{
tagSTGMEDIUM * data;
CClientDC dcRef( this );
data = new tagSTGMEDIUM;
CMetaFileDC * dcMeta;
dcMeta = new CMetaFileDC();
COleDataSource* pData = new COleDataSource;
CRect lmbr;
GetClientRect(lmbr);
//replace "ImageName" with a description of this image
dcMeta->CreateEnhanced(&dcRef, NULL, NULL,"ImageName\0Copy\0\0" );
dcMeta->SetMapMode(MM_TEXT);
//actually draw to the device context
OnDraw(dcMeta);
//done drawing
data->tymed = TYMED_ENHMF;
data->hEnhMetaFile = dcMeta->CloseEnhanced();
pData->CacheData( CF_ENHMETAFILE, data );
pData->SetClipboard();
delete dcMeta;
delete data;
}Top [url=]13 楼[/url]crystal521(【云淡风轻】)回复于 2004-09-27 15:00:33 得分 0 用GetClipboardData 从系统剪贴板中读取数据Top [url=]14 楼[/url]cbc(逍遥子)回复于 2004-09-29 08:34:12 得分 0 好,谢谢,我回去试一下 Top [url=]15 楼[/url]cbc(逍遥子)回复于 2004-10-05 03:18:08 得分 0 能不能作为位图处理Top [url=]16 楼[/url]techgopher(米粒之珠也放光华)回复于 2004-10-05 07:26:28 得分 0 关于格式: 旧版的Word是Windows Meta File (WMF)格式,新的(XP以上?) 是Enhanced Meta File(EMF).Top [url=]17 楼[/url]nwpulipeng(☆→【★海阔天空★】)回复于 2004-10-05 11:00:29 得分 0 帮顶混分Top [url=]18 楼[/url]fbmsf(FBM)回复于 2004-10-05 11:20:42 得分 0 研究了一下:
结果如下:
invoke OpenClipboard,0
invoke EnumClipboardFormats,0
pp:
cmp eax,0
je @F
push eax
invoke GetClipboardFormatName,eax,addr buf,1024
invoke MessageBox,0,addr buf,0,0
pop eax
invoke EnumClipboardFormats,eax
jmp pp
运行结果:(copy word 的自定义图形后)
的几种类型GetClipboardFormatName得到)
DataObject
Office Drawing Shape Format
Office Drawing Shape Format
Office Drawing Shape Format
PNG+Office Art
JFIF+Office Art
GIF+Office Art
PNG
JFIF
GIF
Ole Private Data
我现在没有msdn,你查查msdn。Top [url=]32 楼[/url]dawning371(风刃)回复于 2004-10-09 09:59:22 得分 0 强,但是结果好象是图象的方式显示出来的,而且是拉伸的,能不能以原大小显示啊?--估计不行?Top [url=]33 楼[/url]cbc(逍遥子)回复于 2004-10-09 15:46:47 得分 0 对,是以位图的方式显示出来的,我现在也不知道如何以原始大小显示啊Top [url=]34 楼[/url]fbmsf(FBM)回复于 2004-10-11 09:10:34 得分 0 Displaying a Picture and Storing It in an Enhanced Metafile
This section contains an example demonstrating the creation of a picture and the process of storing the corresponding records in a metafile. The example draws a picture to the display or stores it in a metafile. If a display device context handle is given, it draws a picture to the screen using various GDI functions. If an enhanced metafile device context is given, it stores the same picture in the enhanced metafile.
// Set the device context back to its original state.
SetMapMode(hDC, fnMapModeOld);
SelectObject(hDC, hbrOld);
} Top [url=]35 楼[/url]fbmsf(FBM)回复于 2004-10-11 09:11:42 得分 0 Creating an Enhanced Metafile
This section contains an example that demonstrates the creation of an enhanced metafile that is stored on a disk, using a file name specified by the user.
The example uses a device context for the application window as the reference device context. (The system stores the resolution data for this device in the enhanced-metafile's header.) The application retrieves a handle identifying this device context by calling the GetDC function.
The example uses the dimensions of the application's client area to define the dimensions of the picture frame. Using the rectangle dimensions returned by the GetClientRect function, the application converts the device units to .01-millimeter units and passes the converted values to the CreateEnhMetaFile function.
The example displays a Save As common dialog box that enables the user to specify the file name of the new enhanced metafile. The system appends the three-character .emf extension to this file name and passes the name to the CreateEnhMetaFile function.
The example also embeds a text description of the picture in the enhanced-metafile header. This description is specified as a resource in the string table of the application's resource file. However, in a working application, this string would be retrieved from a custom control in a common dialog box or from a separate dialog box displayed solely for this purpose.
// Obtain a handle to a reference device context.
hdcRef = GetDC(hWnd);
// Determine the picture frame dimensions.
// iWidthMM is the display width in millimeters.
// iHeightMM is the display height in millimeters.
// iWidthPels is the display width in pixels.
// iHeightPels is the display height in pixels
// Retrieve the coordinates of the client
// rectangle, in pixels.
GetClientRect(hWnd, &rect);
// Convert client coordinates to .01-mm units.
// Use iWidthMM, iWidthPels, iHeightMM, and
// iHeightPels to determine the number of
// .01-millimeter units per pixel in the x-
// and y-directions.
// Display the Filename common dialog box. The
// filename specified by the user is passed
// to the CreateEnhMetaFile function and used to
// store the metafile on disk.
if (!hdcMeta)
errhandler("CreateEnhMetaFile", hWnd);
// Release the reference device context.
ReleaseDC(hWnd, hdcRef); Top [url=]36 楼[/url]fbmsf(FBM)回复于 2004-10-11 09:12:41 得分 0
这段代码可能就是(我没有试)
// Determine the picture frame dimensions.
// iWidthMM is the display width in millimeters.
// iHeightMM is the display height in millimeters.
// iWidthPels is the display width in pixels.
// iHeightPels is the display height in pixels
// Retrieve the coordinates of the client
// rectangle, in pixels.
GetClientRect(hWnd, &rect);
// Convert client coordinates to .01-mm units.
// Use iWidthMM, iWidthPels, iHeightMM, and
// iHeightPels to determine the number of
// .01-millimeter units per pixel in the x-
// and y-directions.