”defaultBootstrap_InitialComponentContext(); “ is failed below , I don't
know why ?
what's the deference between "defaultBootstrap_InitialComponentContext();"
and " ::cppu::bootstrap()" ?
int main(){
// get the remote office component context
Reference< XComponentContext > xContext( ::cppu::bootstrap() );
//Reference< XComponentContext > xContext =
// defaultBootstrap_InitialComponentContext();
//if ( !xContext.is() )
//{
// fprintf(stderr, "no component context!\n");
// return 1;
//}
// get the remote office service manager
Reference< XMultiComponentFactory > rOfficeServiceManager(
xContext->getServiceManager() );
//if ( !rOfficeServiceManager.is() )
//{
// fprintf(stderr, "no service manager!\n");
// return 1;
//}
//Obtaining a desktop interface
Reference< XInterface > xDesktop =
rOfficeServiceManager->createInstanceWithContext(
OUString::createFromAscii( "com.sun.star.frame.Desktop" ),xContext);
// query a XcomponentLoader Interface
Reference< XComponentLoader > rComponentLoader (xDesktop, UNO_QUERY);
//if( rComponentLoader.is() )
//{
// printf( "XComonentloader succesfully instanciated\n"
);
//}
Reference< XComponent > xcomponent =
rComponentLoader->loadComponentFromURL(
OUString::createFromAscii("private:factory/scalc"),
OUString::createFromAscii("_blank"),
0,
Sequence < ::com::sun::star::beans::PropertyValue >());
return 0;
}
--
作智慧的减法 ...
体会生活的微妙的富足 ...
嗯 ...