我怎样才能获得特定的运行实例? [英] How Can I get specfic running instance?

查看:80
本文介绍了我怎样才能获得特定的运行实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!大家好!



Hello! everyone!

AutoCAD::IAcadApplication *pAcad;
CLSID clsid;

HRESULT hr= ::CLSIDFromProgID(L"AutoCAD.Application", &clsid);
if (FAILED(hr))
return;
HRESULT res=::GetActiveObject(clsid, NULL, &pUnk);
if(res != S_OK)
  return;





它是AutoCAD程序,现在我想在我的应用程序中通过COM自动化它。



现在问题是 GetActiveObject (clsid,NULL和& pUnk);我无法控制它。



如果用户有多个AutOCAD实例在运行。我如何保证始终获得最新创建的?



如果我的应用程序通过 ShellExecuteEX 启动autocad,那么我可以获得它的Hanlde。



通过这个Handle,我可以得到相应的Com的对象吗?



谢谢!



It's AutoCAD program,Now I want to automate it by COM in my app.

Now the problem is GetActiveObject(clsid, NULL, &pUnk); I cann't get more control on it.
i.e
IF the user have several AutOCAD instances running . And How I can guarantee that always get the most newly created one?

And if my app startup the autocad by ShellExecuteEX then I can get the Hanlde of it.

By this Handle, May I get it's corresponding Com's object?

THANKS!

推荐答案

首先:有关AutoCad评估的详细信息,请参阅Autocad社区的一些论坛。



第二:为什么你没有阅读有关ShellExecuteEX的文档???



http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v = vs.85)的.aspx [ ^ ]



有一个句柄是一个输出参数:mad:
First: For details about the AutoCad autimation you better consult some forums of the Autocad-community.

Second: Why havent you read the doc about ShellExecuteEX ???

http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).aspx[^]

There is a handle is a out parameter :mad:


这篇关于我怎样才能获得特定的运行实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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