几何尺寸与公差论坛

 找回密码
 注册
查看: 815|回复: 0

【转帖】standalone applications

[复制链接]
发表于 2009-4-13 14:39:27 | 显示全部楼层 |阅读模式
standalone applications
hello everyone,
i am writting a standalone application that is meant to connect to and interact with solidworks. i have noticed that if i try to run the exe on a machine that does not have solidworks installed it crashes without giving out any helpful reason. i have also noticed that if i run the application form a shared location on the network on a machine that does have solidworks it still crashes.
is there a way to detect if a machine has solidworks installed or even is there a way to avoid this crash and just inform the user that the machine he is on does not have solidworks?
cheers,
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
hi...
u should first check from the registry to see if solidworks is installed on the machine.
now this check should be independent of the solidworks version. meaning the check should not be hardcoded for a particular guid. the external class name should be used.
in vc++ :-
afx_manage_state(afxgetstaticmodulestate());
uses_conversion;
clsid clsid;
hresult hrcls;
lpctstr lpcls = "sldworks.application";
lpcolestr lpclsid = t2cole(lpcls);
hrcls= ::clsidfromprogid(lpclsid, &clsid);
if (failed(hrcls))
{
//solidworks is not installed on your machine
return false;
}
else
{
//solidworks is installed on your machine
return true;
}
in dot net c#:-
//get type of solidworks com object
type solidworkstype = type.gettypefromprogid("sldworks.application");
if (solidworkstype == null)
{
//solidworks is not installed on your machine
return false;
}
else
{
//solidworks is installed on your machine
return true;
}
regards
jaskaran
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 22:40 , Processed in 0.035742 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表