本文介绍了我怎样才能获得特定的运行实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好!大家好!
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!
推荐答案
这篇关于我怎样才能获得特定的运行实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!