I have recently switched to a new computer running SWX 2009, and I can no longer run an API interface that I wrote. My old machine was running SWX 2007. Both are 32 bit.
The program gets to this line:
hres = swApp.CoCreateInstance(
__uuidof(SldWorks), NULL, CLSCTX_LOCAL_SERVER);
When I use the debugger to look at the value of hres after this point, it is "0x80040154 Class not registered". The first chunk of code from the program is below.
Is there a DLL that I need to (re)register?
Thanks in advance,
Greg
code.cpp:
#include
"stdafx.h" HRESULT hres = NOERROR;
using
namespace std;
int
_tmain() {
//Initialize COM
hres = CoInitialize(NULL);
//Use ATL smart pointers
CComPtr
CComPtr
CComPtr
CComPtr
do
{
try
{
hres = swApp.CoCreateInstance(__uuidof(SldWorks), NULL, CLSCTX_LOCAL_SERVER);
...
_________________
stdafx.h:
#pragma
once #define
WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include
#include
#include
#define
_ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include
#include
#include
using
namespace std; //Use the standard C++ libraries for text output.
#import
"sldworks.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //the SolidWorks type library
#import
"swconst.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //the SolidWorks constant type library
SolidworksApi macros