hello everyone,
I'm trying to use uno controls independently without OO runing.
but when I try to create the com.sun.star.awt.Toolkit service in my program,
it crashes.
I have tried to create other services (e.g. UnoButtonModel), and it seeems
ok.
I use OOo 2.4 on windows platform with Visual C++ for this testing, and here
is how I do:
first, I implement a uno component with XMain interface.
in its run method, I just try to get the service manager through the
component context that I have restored during the component instantiation.
virtual ::sal_Int32 SAL_CALL run(const Sequence< ::rtl::OUString >&
aArguments) SAL_THROW((RuntimeException))
{
if (m_xContext.is())
MessageBox(NULL, TEXT("1 OK!"), TEXT("Msg"), MB_OK);
Reference<lang::XMultiComponentFactory> xMultiFactory =
m_xContext.get()->getServiceManager();
if (xMultiFactory.is())
MessageBox(NULL, TEXT("2 OK!"), TEXT("Msg"), MB_OK);
Reference<XInterface> xInterface =
xMultiFactory.get()->createInstanceWithContext(L"com.sun.star.awt.Toolkit",
m_xContext);
if (xInterface.is())
MessageBox(NULL, TEXT("3 OK!"), TEXT("Msg"), MB_OK);
return 0;
}
then I register all uno dll components in [OFFICE_PROGRAM_PATH] with my
component into a new rdb file.(myservices.rdb)
finally I run uno -s MY_SERVICENAME -ro myservices.rdb to startup my uno
component.
when the component is runing, it shows the first two message boxes as
expected, and crashes without showing the last one.
but if I replace "com.sun.star.awt.Toolkit" with
"com.sun.star.awt.UnoButtonModel" or
"com.sun.star.awt.ContainerWindowProvider" instead, it runs correctly with
all message boxes displayed.
so why cant I create the Toolkit service in my component? does this serivce
depend on other services or things which I haven't prepared ready?
hope for your reply, and thanks very much!
best wishes!
Rainman.