1 |
francois |
283 |
//--------------------------------------------------------------------------- |
2 |
|
|
|
3 |
|
|
#pragma hdrstop |
4 |
|
|
|
5 |
|
|
#include<Atl/atlbase.h> |
6 |
|
|
|
7 |
|
|
#include<SldWorks_TLB.h> |
8 |
|
|
#include<SwConst_TLB.h> |
9 |
|
|
|
10 |
|
|
#include<atl\atlmod.h> |
11 |
|
|
#include<iostream.h> |
12 |
|
|
TComModule&_Module=*static_cast<TComModule*>(NULL); |
13 |
|
|
|
14 |
|
|
#include <conio.h> |
15 |
|
|
//--------------------------------------------------------------------------- |
16 |
|
|
|
17 |
|
|
#pragma argsused |
18 |
|
|
int main(int argc, char* argv[]) |
19 |
|
|
{ |
20 |
|
|
//ouverture de la connection |
21 |
|
|
CoInitialize(NULL); |
22 |
|
|
CComPtr<ISldWorks>swApp; |
23 |
|
|
CComPtr<IModelDoc2> swModel; |
24 |
|
|
|
25 |
|
|
HRESULT hres=swApp.CoCreateInstance(CLSID_SldWorks_, NULL, CLSCTX_LOCAL_SERVER); |
26 |
|
|
|
27 |
|
|
if ( swApp==NULL) |
28 |
|
|
{ |
29 |
|
|
printf("erreur: ne peut se connecter � SW\n"); |
30 |
|
|
return 1; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
//fermeture de la connexion |
35 |
|
|
swApp->ExitApp(); |
36 |
|
|
swApp=NULL; |
37 |
|
|
CoUninitialize(); |
38 |
|
|
return 0; |
39 |
|
|
} |
40 |
|
|
//--------------------------------------------------------------------------- |
41 |
|
|
|