Buzzsaw Forum Archive
Welcome to Autodesk’s Buzzsaw Forums. Share your knowledge, ask questions, and explore popular Buzzsaw topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VC++, Scripting API, Error at CreateInstance, Error code "800401F0" .

2 REPLIES 2
Reply
Message 1 of 3
hondato
1224 Views, 2 Replies

VC++, Scripting API, Error at CreateInstance, Error code "800401F0" .

I allways have an error code "800401F0" with a program code, sts = spIPPSession.CreateInstance(clsid);

Can anyone give me an advice to avoid or fix this error?

How should I correct the program source?

Please see the program source as below. 

 

 

#include "stdafx.h"
//#include "stdio.h"

#import "C:/Program Files/ProjectPoint API Toolkit/ProjectPointClient.dll" no_namespace
//#import "c:\users\hondato\desktop\hondato\mhi nagasaki\bzs_2010\Debug\ProjectPointClient.dll" no_namespace

int bazlink(void);

//-------------------------------------------------------------------------------
int _tmain(int argc, _TCHAR* argv[])
{
 bazlink();
 return 0;
}
//--------------------------------------------------------------------------------------
int bazlink(void)
{
 CLSID   clsid;
 
 _bstr_t bstrSiteName = "https://webdav.buzzsaw.com/testbuz"; //
 _bstr_t bstrUsername = "User1";         //
 _bstr_t bstrPassword = "Password1";        //
 _bstr_t resultString = "";

 HRESULT hr = CLSIDFromProgID(OLESTR("ProjectPointClient.PPScripting.1"), &clsid);
 
 IPPSessionPtr  spIPPSession;
 spIPPSession = NULL;
 long sts;
 char buf[10];

 sts = spIPPSession.CreateInstance(clsid); 

 sprintf(buf, "%X", sts);
 resultString = buf;

 //_bstr_t s = n.ToString("X2");

 spIPPSession->LogIn(bstrUsername, bstrPassword, bstrSiteName);
 spIPPSession->LogOut ();

 return 1;

 

 

2 REPLIES 2
Message 2 of 3
hondato
in reply to: hondato

I just found that I used "ProjectPoint.PPScripting.1" to get clsid, but used it for PPSession CreateInstance.

I also added CoInitialize and CoCreateInstance as below, then the program runs well!!

 

 

 

 

 HRESULT hr = CoInitialize(NULL);
 printf("CoInitialize %X\n", hr);

 

 hr = CLSIDFromProgID(OLESTR("ProjectPointClient.PPSession.1"), &clsid);
 printf("CLSIDFromProgID %X\n", hr);

 

 hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, __uuidof(IUnknown), reinterpret_cast<void**>(&spIPPSession));
 printf("CoCreateInstance %X\n", hr);

 

 hr = spIPPSession.CreateInstance(clsid); 
 printf("CreateInstance %X\n", hr);

 

 hr = spIPPSession->LogIn(bstrUsername, bstrPassword, bstrSiteName);
 printf("CreateInstance %X\n", hr);

 

 hr = spIPPSession->LogOut();
 printf("CreateInstance %X\n", hr);

 

Message 3 of 3
dave.watt
in reply to: hondato

Great!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report