从剪贴板获取CF_ENHMETAFILE [英] Getting CF_ENHMETAFILE from clipboard

查看:230
本文介绍了从剪贴板获取CF_ENHMETAFILE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大家好!


有没有人尝试过subj?


我使用extern IsClipboardFormatAvailable和GetClipboardData来自

user32.dll。 IsClipboardFormatAvailable(14)返回true,但

GetClipboardData(14)之后返回空指针。


我找到了可以从剪贴板获取CF_ENHMETAFILE的工作源代码,

但它们是C ++ WinAPI应用程序。也许有一些诡计,但我不能用b $ b看到使用方法的不同。


提前感谢你提出任何意见。< br $>

祝你好运,

A. Dzizenko


Hi all!

Did anyone try the subj?

I use extern IsClipboardFormatAvailable and GetClipboardData from
user32.dll. IsClipboardFormatAvailable(14) returns true, but
GetClipboardData(14) returns null-pointer after that.

I found working source codes that can get CF_ENHMETAFILE from clipboard,
but they are C++ WinAPI applications. Maybe there''s some ruse, but I can''t
see the difference in method using.

Thank you in advance for any advices.

Best regards,
A. Dzizenko

推荐答案

Andrey,


为什么不在IDataObject实现上使用GetData方法

传递给你?你可以通过DataFormats.EnhancedMetafile来获得你想要的东西。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse .com


" Andrey Dzizenko" < A ******** @ logicexplorers.com>。在消息中写道

news:op *************** @ dzizenko.lei.com ...


大家好!


有没有人尝试过subj?


我使用来自

user32的extern IsClipboardFormatAvailable和GetClipboardData。 DLL。 IsClipboardFormatAvailable(14)返回true,但

GetClipboardData(14)之后返回空指针。


我找到了可以从剪贴板获取CF_ENHMETAFILE的工作源代码,

但它们是C ++ WinAPI应用程序。也许有一些诡计,但我不能用b $ b看到使用方法的不同。


提前感谢你提出任何意见。< br $>

祝你好运,

A. Dzizenko
Andrey,

Why not just use the GetData method on the IDataObject implementation
passed to you? You can pass DataFormats.EnhancedMetafile to get what you
want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andrey Dzizenko" <A.********@logicexplorers.com> wrote in message
news:op***************@dzizenko.lei.com...

Hi all!

Did anyone try the subj?

I use extern IsClipboardFormatAvailable and GetClipboardData from
user32.dll. IsClipboardFormatAvailable(14) returns true, but
GetClipboardData(14) returns null-pointer after that.

I found working source codes that can get CF_ENHMETAFILE from clipboard,
but they are C++ WinAPI applications. Maybe there''s some ruse, but I can''t
see the difference in method using.

Thank you in advance for any advices.

Best regards,
A. Dzizenko


在c#中你可以使用P-Invoke,以下调用:

1)OpenClipboard

2)IsClipboardFormatAvailable(CF_ENHMETAFILE)

3)如果为true,则使用GetClipboardData(CF_ENHMETAFILE)获取一个IntPtr到

的EnhancedMetafile句柄

4)使用CopyEnhMetaFile制作副本供你使用,因为剪贴板保留了句柄所有权
的所有权。

5)CloseClipboard


确保使用正确的P-Invoke签名。从
http://www.pinvoke.net 复制


" Andrey Dzizenko" < A ******** @ logicexplorers.com>。在消息中写道

news:op *************** @ dzizenko.lei.com ...


大家好!


有没有人尝试过subj?


我使用来自

user32的extern IsClipboardFormatAvailable和GetClipboardData。 DLL。 IsClipboardFormatAvailable(14)返回true,但

GetClipboardData(14)之后返回空指针。


我找到了可以从剪贴板获取CF_ENHMETAFILE的工作源代码,

但它们是C ++ WinAPI应用程序。也许有一些诡计,但我不能用b $ b看到使用方法的不同。


提前感谢你提出任何意见。< br $>

祝你好运,

A. Dzizenko
In c# you may use P-Invoke, with the following calls:
1) OpenClipboard
2) IsClipboardFormatAvailable(CF_ENHMETAFILE)
3) If true, then use GetClipboardData(CF_ENHMETAFILE) to get an IntPtr to
the EnhancedMetafile handle
4) Use CopyEnhMetaFile to make a copy for your use as the clipboard retains
ownership of the handle.
5) CloseClipboard

Make sure you use the correct P-Invoke signatures. Copy them from
http://www.pinvoke.net

"Andrey Dzizenko" <A.********@logicexplorers.com> wrote in message
news:op***************@dzizenko.lei.com...

Hi all!

Did anyone try the subj?

I use extern IsClipboardFormatAvailable and GetClipboardData from
user32.dll. IsClipboardFormatAvailable(14) returns true, but
GetClipboardData(14) returns null-pointer after that.

I found working source codes that can get CF_ENHMETAFILE from clipboard,
but they are C++ WinAPI applications. Maybe there''s some ruse, but I can''t
see the difference in method using.

Thank you in advance for any advices.

Best regards,
A. Dzizenko


哦...对不起,我忘了提那...


Clipboard.ContainsData(DataFormats.EnhancedMetafil e)返回false。并且

所有其他格式也是。

..NET剪贴板无法看到数据(这是MSWord的图片)。在
http://support.microsoft.com/?id= 323530


祝你好运,

A. Dzizenko。
Oh... Sorry, I forgot to mention that...

Clipboard.ContainsData(DataFormats.EnhancedMetafil e) returns false. And
all other formats too.
..NET Clipboard can''t see the data (it''s MSWord''s picture). Explained at
http://support.microsoft.com/?id=323530

Best regards,
A. Dzizenko.


这篇关于从剪贴板获取CF_ENHMETAFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆