OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Using COM for OOo with different languages
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
MakuG
General User
General User


Joined: 03 Feb 2004
Posts: 10

PostPosted: Wed Dec 08, 2004 5:33 am    Post subject: memory leakage Reply with quote

Hi Christian,

30 times may not be enough. See the c# example for details:
Code:
using System;
using System.Reflection;

namespace DefaultNamespace
{
  class MainClass
  {
    static object Invoke(object obj,string method, params object[] par)
    {
      return obj.GetType().InvokeMember(method,BindingFlags.InvokeMethod,null,obj,par);
    }
     
    public static void Main(string[] args)
    {
      object usm=Activator.CreateInstance(Type.GetTypeFromProgID("com.sun.star.ServiceManager"));
      object desk=Invoke(usm,"createInstance","com.sun.star.frame.Desktop");
      for(int i=0;i<1000;++i)
      {
        object calcDoc=Invoke(desk,"loadComponentFromURL","private:factory/scalc","_blank",0,new object[0]);
        Invoke(calcDoc,"close",true);
     }
    }
  }
}

Oliver
Back to top
View user's profile Send private message
MakuG
General User
General User


Joined: 03 Feb 2004
Posts: 10

PostPosted: Wed Dec 22, 2004 6:05 am    Post subject: Reply with quote

Hi all,

Here in the forum there are a couple of "memory leak" posts. One tells something about an issue at issuezilla (14349). There it is been said that the cause for mem leaks may lay in the garbage collector and will be fixed with OpenOffice2.0. I tried it again with the c# example given in my last post on OpenOffice1.1.4 but found the same leakage.

Oliver
Back to top
View user's profile Send private message
shibu
General User
General User


Joined: 16 Dec 2004
Posts: 6

PostPosted: Thu Dec 30, 2004 11:37 pm    Post subject: Reply with quote

Is there any one who has tried it with coldfusion
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Fri Dec 31, 2004 1:33 pm    Post subject: Reply with quote

shibu: No, do you want to try and test it? If so you're more than welcome to do some pioneering work on that. And if you got it working please let me know and I will add it to the list - of course saying that it comes from you.

MakuG: That's not good Sad. I hate mutex anyway.

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
shibu
General User
General User


Joined: 16 Dec 2004
Posts: 6

PostPosted: Fri Dec 31, 2004 11:05 pm    Post subject: Reply with quote

I will surely post it to you If I succeed.

Just one more point to ask about.

I tried the "hello world " example with the cold fusion using the same procedure as you have explained for vb & PHP. The problem is that when I try to execute the code it is getting stuck. ie. no result was displayed (The browser was not showing the done mode) even after waiting for hours.

Please explain what this could be?


Also I tried the same procedure with ASP, it ended up with the same result as above.

Folowing are my code.

ASP :

Code:
<%
   Dim objServiceManager 'As Object
   Dim objDesktop 'As Object
   Dim args()
   
   Set objServiceManager= Server.CreateObject("com.sun.star.ServiceManager")
   Set Stardesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
   Set doc = Stardesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
   Set text = doc.getText()
   text.setString("Hello World")

%>


COLDFUSION :

Code:
<CFSET oAgrs = ArrayNew(1)>
<CFOBJECT action="connect" name="objServiceManager" class="com.sun.star.ServiceManager" >
<CFSET Stardesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")>
<CFSET doc = Stardesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, oArgs )>
<CFSET text = doc.getText() >
<CFSET text.setString("Hello World")>



I believe, I have installed all that is required to do the COM Programming for Openofice.


Please suggest.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
sujata
General User
General User


Joined: 21 Feb 2005
Posts: 5

PostPosted: Wed Apr 20, 2005 2:17 pm    Post subject: Re: Using COM for OOo with different languages Reply with quote

[quote="Cybb20"
can u tell me the exact compile options to be used while compiling the C++ program with GCC ( openoffice access through C++ code sent by u )
m geting error as
'VTable not a member of structure'
guess m not including some headers... so pls help

thanks
regards
sujata
Back to top
View user's profile Send private message Send e-mail
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Thu Apr 21, 2005 2:04 am    Post subject: Reply with quote

Hi sujata, as I pointed out in my email to you, it is important that you are on the correct platform, here it means that you need to have Windows NT or above running (Windows 98 might also work).
Another thing is that you need to have the Win32 API library and the necessary header files, those do already come together with MS Visual Studio but since you're trying to compile it with GCC, you need to explicitly download them (www.mingw.org has a Win32API package for example).
The C I posted was actually written and tested for MinGW (GCC).
And please note that the given example is in C, it is not necessarily working for C++, since some structures have changed or have become classes (MFC).
And I know there is a difference between the vtable in the C++ and C version.
It's up to you to find the differences, otherwise if this doesn't give you the desired information to find it out on your own, I am willing to help you finding it out.

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
MikoOO
Newbie
Newbie


Joined: 26 May 2005
Posts: 1
Location: France

PostPosted: Thu May 26, 2005 1:10 pm    Post subject: Tcl Code Reply with quote

Hi,
This Tcl code works for me (tested with tclsh and freewrap)
package require tcom
set OO [::tcom::ref createobject "com.sun.star.ServiceManager"]
set OD [$OO createInstance com.sun.star.frame.Desktop ]
array set arguments {}
set doc [$OD LoadComponentFromUrl private:factory/scalc _blank 0 [parray arguments]]


You were missing "[parray arguments]"...

Nice post anyway..
_________________
Tcl is good for you
Back to top
View user's profile Send private message
Rau
Newbie
Newbie


Joined: 06 Aug 2005
Posts: 2

PostPosted: Sat Aug 06, 2005 6:56 pm    Post subject: How can I do this with Oracle Developer? Reply with quote

How can I do this with Oracle Developer?
Someone know´s how to do this thing happen´s?
_________________
Rau ´-)
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Sun Aug 07, 2005 11:47 am    Post subject: Reply with quote

MikoOO:
Thanks you so much, I will update the Tcl example right in a minute with your correction.

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
hinek
General User
General User


Joined: 21 Jun 2005
Posts: 10
Location: Germany

PostPosted: Thu Aug 25, 2005 1:28 am    Post subject: Reply with quote

I'm working with C# ... opening a SXW, printing and closing it.

Sometimes the code works fine, sometimes it trows this exception:

Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): InterfaceOleWrapper_Impl::doInvoke :
Unexpected exception

Some idea, what it could be?
Back to top
View user's profile Send private message
shevegen
Newbie
Newbie


Joined: 14 Nov 2003
Posts: 4

PostPosted: Thu Aug 25, 2005 5:52 pm    Post subject: Reply with quote

Is this all only possible on Windows Platforms?
Back to top
View user's profile Send private message
hinek
General User
General User


Joined: 21 Jun 2005
Posts: 10
Location: Germany

PostPosted: Fri Aug 26, 2005 1:45 am    Post subject: Reply with quote

Ok, I found the problem:
I changed the Registrykey of the ServiceManager from
C:\Program Files\OpenOffice.org1.1.4\program\soffice.exe -nodefault -nologo
to
C:\Program Files\OpenOffice.org1.1.4\program\soffice.exe -nologo

Now it works, but I don't know why or even know what the -nodefault trigger does.

Ok, another question: is there a debug mode in OOo 1.1.4, that I can activate and that logs everything to a file or to the windows eventlog ... that would help me, finding errors in future.

Thx for everything ...
Back to top
View user's profile Send private message
hinek
General User
General User


Joined: 21 Jun 2005
Posts: 10
Location: Germany

PostPosted: Fri Aug 26, 2005 1:48 am    Post subject: Reply with quote

shevegen wrote:
Is this all only possible on Windows Platforms?


Yes COM Automation is only avaible for Windows Platforms ...
But maybe there are ways to automate OOo in other OS ... I don't know.
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Fri Aug 26, 2005 8:08 am    Post subject: Reply with quote

There is no debug mode, if you don't build OOo yourself with debug=true, or you use strace. mayber you also have a COM debugger in your C# environment (VisualStudio has one).
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group