Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-28 Thread Rainman Lee
hi Carsten,
it's ok. but I still think that there might be something not
initialized though it's not VCL.
thank you very much, I will keep trying to find the murderer. ;)
best wishes, Rainman.

On Fri, Jun 20, 2008 at 8:59 PM, Carsten Driesner
[EMAIL PROTECTED] wrote:
 Rainman Lee wrote:

 thank you very much Carsten!
 I will try it.
 but, I guess i was missing something by far.
 I notice that there is a InitVCL call, in the file you mentioned. but it
 seems that it need something like a static or dynamic lib to get it work.
 where can I get such a lib, should I compile the vcl project on my
 computer
 or I can just download it somewhere.
 thank you, and hope your reply.

 Hi Rainman,

 Sorry for the wrong information. I missed a special part inside the toolkit
 project which takes over the VCL initialization in case the Application
 object is not in execute mode, which is true in your case. Currently I am
 without a clue why you can see a crash creating com.sun.star.awt.Toolkit.
 May be you can write an issue via Issue Tracker and attach some sample code
 to reproduce your problem.

 Regards,
 Carsten

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-20 Thread Rainman Lee
thank you very much Carsten!
I will try it.
but, I guess i was missing something by far.
I notice that there is a InitVCL call, in the file you mentioned. but it
seems that it need something like a static or dynamic lib to get it work.
where can I get such a lib, should I compile the vcl project on my computer
or I can just download it somewhere.
thank you, and hope your reply.

best wishes, Rainman.

On Thu, Jun 19, 2008 at 11:14 PM, Carsten Driesner [EMAIL PROTECTED]
wrote:

 Rainman Lee wrote:

 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);

Referencelang::XMultiComponentFactory xMultiFactory =
 m_xContext.get()-getServiceManager();
if (xMultiFactory.is())
MessageBox(NULL, TEXT(2 OK!), TEXT(Msg), MB_OK);

ReferenceXInterface xInterface =

 xMultiFactory.get()-createInstanceWithContext(Lcom.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!

 Hi Rainman,

 You have to make sure that VCL is properly initialized before you can use
 UNO awt! UNO awt is a wrapper around VCL and cannot work correctly if VCL
 has not been initialized. To initialize VCL you have to call InitVCL(...).
 You can find how to call InitVCL in the desktop project, e.g. look within
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx at the function getUNO(...).
 There is also a function called DeInitVCL().

 Regards,
 Carsten


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-20 Thread Eike Rathke
Hi Stephan,

On Thursday, 2008-06-19 14:30:09 +0200, Stephan Bergmann wrote:

 On Windows, the L... version should also work, by accident.  
 (sal_Unicode is a typedef for wchar_t there, and there is a non-explicit  
 rtl::OUString(sal_Unicode const *) ctor).

Ah, that explains why a compiler accepts it, after I sent the mail
I already wondered..

Highly unportable though.

  Eike

-- 
 OOo/SO Calc core developer. Number formatter stricken i18n transpositionizer.
 SunSign   0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
 Please don't send personal mail to the [EMAIL PROTECTED] account, which I use 
for
 mailing lists only and don't read from outside Sun. Use [EMAIL PROTECTED] 
Thanks.


pgp3TxmfTvEo9.pgp
Description: PGP signature


Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-20 Thread Caolan McNamara
On Fri, 2008-06-20 at 12:28 +0200, Eike Rathke wrote:
 Hi Stephan,
 
 On Thursday, 2008-06-19 14:30:09 +0200, Stephan Bergmann wrote:
 
  On Windows, the L... version should also work, by accident.  

 Highly unportable though.

gcc has a -fshort-wchar feature (like mozilla uses) and SunPro has a U
string option. I've wondered if there would be any advantage to hacking
up some sort of const_rtl_uString magic which would implement a
rtl_uString compatible layout string struct that could be initialized
from a L/U string, eliding the rtl_uString constructor for such
const rtl_uStrings enabling them to be stored in the rodata section.
Maybe giving some measurable startup performance advantage.

C.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-20 Thread Carsten Driesner

Rainman Lee wrote:

thank you very much Carsten!
I will try it.
but, I guess i was missing something by far.
I notice that there is a InitVCL call, in the file you mentioned. but it
seems that it need something like a static or dynamic lib to get it work.
where can I get such a lib, should I compile the vcl project on my computer
or I can just download it somewhere.
thank you, and hope your reply.


Hi Rainman,

Sorry for the wrong information. I missed a special part inside the 
toolkit project which takes over the VCL initialization in case the 
Application object is not in execute mode, which is true in your case. 
Currently I am without a clue why you can see a crash creating 
com.sun.star.awt.Toolkit. May be you can write an issue via Issue 
Tracker and attach some sample code to reproduce your problem.


Regards,
Carsten

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-19 Thread Rainman Lee
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);

Referencelang::XMultiComponentFactory xMultiFactory =
m_xContext.get()-getServiceManager();
if (xMultiFactory.is())
MessageBox(NULL, TEXT(2 OK!), TEXT(Msg), MB_OK);

ReferenceXInterface xInterface =
xMultiFactory.get()-createInstanceWithContext(Lcom.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.


Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-19 Thread Eike Rathke
Hi Rainman,

On Thursday, 2008-06-19 16:13:01 +0800, Rainman Lee wrote:

 [...]
 ReferenceXInterface xInterface =
 xMultiFactory.get()-createInstanceWithContext(Lcom.sun.star.awt.Toolkit,
 m_xContext);
 [...]
 when the component is runing, it shows the first two message boxes as
 expected, and crashes without showing the last one.

I'm almost certain that Lsome string is the culprit, because the
method expects a rtl::OUString there. Use
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(com.sun.star.awt.Toolkit))
instead.

However, that would not explain why that

 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.

works, but I guess it just does not crash by accident because of
different memory layout.

  Eike

-- 
 OOo/SO Calc core developer. Number formatter stricken i18n transpositionizer.
 SunSign   0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
 Please don't send personal mail to the [EMAIL PROTECTED] account, which I use 
for
 mailing lists only and don't read from outside Sun. Use [EMAIL PROTECTED] 
Thanks.


pgpZNMgxrz7Tw.pgp
Description: PGP signature


Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-19 Thread Stephan Bergmann

Eike Rathke wrote:

Hi Rainman,

On Thursday, 2008-06-19 16:13:01 +0800, Rainman Lee wrote:


[...]
ReferenceXInterface xInterface =
xMultiFactory.get()-createInstanceWithContext(Lcom.sun.star.awt.Toolkit,
m_xContext);
[...]
when the component is runing, it shows the first two message boxes as
expected, and crashes without showing the last one.


I'm almost certain that Lsome string is the culprit, because the
method expects a rtl::OUString there. Use
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(com.sun.star.awt.Toolkit))
instead.


On Windows, the L... version should also work, by accident. 
(sal_Unicode is a typedef for wchar_t there, and there is a non-explicit 
rtl::OUString(sal_Unicode const *) ctor).


-Stephan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] Please help for creating com.sun.star.awt.Toolkit service

2008-06-19 Thread Rainman Lee
I just googled my problem, and there was a same problem 3 years ago.(
http://osdir.com/ml/openoffice.devel.udk/2005-09/msg00076.html)
but unfortunately, no solution at that time.
Is there someone kind can fix it today?
thanks again.

best wishes, Rainman

On Thu, Jun 19, 2008 at 8:30 PM, Stephan Bergmann [EMAIL PROTECTED]
wrote:

 Eike Rathke wrote:

 Hi Rainman,

 On Thursday, 2008-06-19 16:13:01 +0800, Rainman Lee wrote:

  [...]
ReferenceXInterface xInterface =

 xMultiFactory.get()-createInstanceWithContext(Lcom.sun.star.awt.Toolkit,
 m_xContext);
 [...]
 when the component is runing, it shows the first two message boxes as
 expected, and crashes without showing the last one.


 I'm almost certain that Lsome string is the culprit, because the
 method expects a rtl::OUString there. Use
 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(com.sun.star.awt.Toolkit))
 instead.


 On Windows, the L... version should also work, by accident. (sal_Unicode
 is a typedef for wchar_t there, and there is a non-explicit
 rtl::OUString(sal_Unicode const *) ctor).

 -Stephan

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]