查看单个帖子
旧 2009-04-13, 02:39 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】standalone applications

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)