On 04/07/2011 12:08 PM, Niklas Nebel wrote:
On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote:
I had hoped it would be as easy as

CreateUnoService("com.sun.star.awt.PrinterServer")

Unfortunately, the returned object is not usable.

"Usable" is a relative term. You can always do something like this:

oServer = CreateUnoService("com.sun.star.awt.PrinterServer")
oCore = CreateUnoService("com.sun.star.reflection.CoreReflection")
oClass = oCore.forName("com.sun.star.awt.XPrinterServer")
oMethod = oClass.getMethod("getPrinterNames")
aNames = oMethod.invoke(oServer, Array())

Niklas
Wow, thanks..... Thanks to Ariel, I have a few links, one of which brings me here:


http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66

Which I assume explains why we need to jump through the hoops mentioned above. I am amazed.... Never occurred to me that this could be done.

Marc, in answer to your question of why, I assume that it is because the type detection stuff is not in place so Basic cannot see the required interface. (or something like that.... Did not give that comment much thought since my three year old is dragging me off my computer chair).

Thanks!

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php

--
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help

Reply via email to