Failure when calling RegisterSolution

H

Howard Swope

When I call register solution I get the error 0x8004302D. I can not find
reference to this anywhere. Anybody know what it means?

The code I am using to register solution is:

#include <windows.h>

#include <objbase.h>

#include <comdef.h>

#include <stdlib.h>



#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\INFOPATH.EXE"
no_namespace raw_interfaces_only named_guids





int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine,int nCmdShow)

{

HRESULT hr;

_ExternalApplicationPtr pExternalApplication;

_bstr_t bstrSolutionUrl;

_bstr_t bstrBehavior = "overwrite";

char fname[_MAX_FNAME], path[MAX_PATH], urlDrive[_MAX_DRIVE],
urlDir[_MAX_DIR], urlFname[_MAX_FNAME], urlExt[_MAX_EXT];

bool uninstall = false;



// parse the commmandline

int argc = 0;

LPWSTR * pArgs = CommandLineToArgvW(GetCommandLineW(),&argc);



// we must have at least the name of the file to register

if (argc <= 1)

return 1;



// get the path

wcstombs(path, pArgs[0],MAX_PATH);

_splitpath(path,urlDrive,urlDir,urlFname,urlExt);



// get the name of the file

wcstombs(fname,pArgs[1],MAX_PATH);



// get the /u if there

if (argc >= 3)

uninstall = true;



// make the full url of file to be registered

_makepath(path,urlDrive,urlDir,fname,NULL);

//bstrSolutionUrl = "file:\\\\";

bstrSolutionUrl += path;





// initialize COM

hr = CoInitialize(NULL);



if (SUCCEEDED(hr))

{



if
(FAILED(pExternalApplication.CreateInstance(CLSID_ExternalApplication)))

{

CoUninitialize();

return 1;

}

if (!uninstall)

hr =
pExternalApplication->RegisterSolution(bstrSolutionUrl,bstrBehavior);

else

hr =
pExternalApplication->UnregisterSolution(bstrSolutionUrl);



pExternalApplication.Release();

CoUninitialize();



if (SUCCEEDED(hr))

return 0;

else

return 1;

}

else

{

return 1;

}

return 0;

}
 
Top