简体   繁体   English

Photoshop COM和C ++(操作方法)

[英]Photoshop COM and C++ (How to)

I would like to use Photoshop via COM using C++, but I'm not sure if I'm getting it right. 我想使用C ++通过COM使用Photoshop,但是不确定是否正确。 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. 我看过很多关于如何使用C#进行操作的教程,甚至尝试过其中一个,但据我所知,COM的意识形态说,您可以使用任何喜欢的语言,因为它的源代码只是二进制。 So, C++ is exactly what I want and to start I should have a photoshop interface class in my client programm, right ? 所以,C ++正是我想要的,开始时,我应该在客户端程序中有一个photoshop接口类,对吗? 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. 即使我有一个,我也将如何了解操作Photoshop实例的功能。 Or maybe I understanding COM + C++ wrong ? 还是我理解COM + C ++错误? Your help is highly appreciate. 非常感谢您的帮助。

Thank you in advance! 先感谢您!

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是与语言无关的,但是它需要大量额外的运行时工作才能要求OS提供指向所需接口和方法的指针。 COM is a huge pain in C++. COM是C ++的巨大痛苦。 You're looking at 5-10 lines of code for a single function call. 您正在为一个函数调用查看5-10行代码。 Microsoft's "helper" libraries like MFC and ATL can help make it easier, but it's still not pretty. 微软的“帮助器”库,例如MFC和ATL可以使它变得更容易,但是它仍然不是很漂亮。

C# abstracts a lot of the details away and makes COM look like regular object-oriented code. C#提取了许多细节,并使COM看起来像常规的面向对象的代码。 In C++, you'd have to write the wrapper class yourself or find someone else's implementation. 在C ++中,您必须自己编写包装器类或找到其他人的实现。 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. 我在C ++中使用COM,所以我会抓住机会用C#代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM