Photoshop COM 和 C++ (如何)
我想使用 C++ 通过 COM 使用 Photoshop,但我不确定是否正确。我看过很多关于如何使用 C# 执行此操作的教程,甚至尝试过其中一个,但据我所知,COM 的意识形态表明您可以使用您喜欢的任何语言,因为它的源代码只是二进制。所以,C++ 正是我想要的,首先我应该在我的客户端程序中有一个 Photoshop 接口类,对吗?所以,问题是:我在哪里可以获得它(接口类)?即使我有一个,我怎么知道操作 Photoshop 实例的功能。或者也许我对 COM + C++ 的理解错误?非常感谢您的帮助。
先感谢您!
I would like to use Photoshop via COM using C++, but I'm not sure if I'm getting it right. I've seen lot's of tutorials on how to do that with C# and even tried one but as far as I know ideology of COM says that you can use any language you like since it's source is just binary. So, C++ is exactly what I want and to start I should have a photoshop interface class in my client programm, right ? So, the question is: Where can I get it (interface class) ? And even if I had one, how would I know about functions to operate photoshop instance. Or maybe I understanding COM + C++ wrong ? Your help is highly appreciate.
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是对的,COM 是语言中立的,但是它需要大量额外的运行时工作来向操作系统请求指向你需要的接口和方法的指针。 COM 是 C++ 中的一个巨大痛苦。您正在查看单个函数调用的 5-10 行代码。 Microsoft 的“辅助”库(例如 MFC 和 ATL)可以帮助使其变得更容易,但它仍然不够漂亮。
C# 抽象了很多细节,使 COM 看起来像常规的面向对象代码。在 C++ 中,您必须自己编写包装类或找到其他人的实现。这不一定很难,但会很乏味。
我在 C++ 中使用 COM,并且我会抓住机会使用 C# 来完成它。
You are right, COM is language-neutral, but it requires a lot of extra runtime work to ask the OS for pointers to the interfaces and methods you need. COM is a huge pain in C++. You're looking at 5-10 lines of code for a single function call. Microsoft's "helper" libraries like MFC and ATL can help make it easier, but it's still not pretty.
C# abstracts a lot of the details away and makes COM look like regular object-oriented code. In C++, you'd have to write the wrapper class yourself or find someone else's implementation. It won't necessarily be hard, but it will be tedious.
I work with COM in C++ and I would jump at the chance to do it with C# instead.