• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Buzzsaw

    Reply
    New Member
    hondato
    Posts: 2
    Registered: ‎02-22-2011

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

    544 Views, 2 Replies
    02-22-2011 10:10 PM

    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;

     

     

    Please use plain text.
    New Member
    hondato
    Posts: 2
    Registered: ‎02-22-2011

    Re: VC++, Scripting API, Error at CreateInstance, Error code "800401F0&quot

    02-24-2011 12:32 AM 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);

     

    Please use plain text.
    Employee
    Posts: 18
    Registered: ‎02-09-2007

    Re: VC++, Scripting API, Error at CreateInstance, Error code "800401F0&

    04-06-2011 04:03 PM in reply to: hondato

    Great!

    Please use plain text.