Am Donnerstag, den 07.04.2011, 18:08 +0200 schrieb Niklas Nebel:
> 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())
Ah, I see. This does work.
Can you explain why the intermediate step using Core Reflection is
necessary, please?
>From those old times there is another macro that must have been working,
and it doesn't (work or use CoreReflection):
function PrinterNameListNew
ps = CreateUnoService("com.sun.star.awt.PrinterServer")
dbgM(ps)
dbgP(ps)
dim xps as object
xps = ps.QueryInterface("com.sun.star.awt.XPrinterServer")
if NOT IsNull(xps) then
dbgM(xps)
else
msgbox "NULL"
endif
PrinterNameListNew = ps.getPrinterNames()
end function
TIA,
Marc
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help