How to get the process id of the document window

Hello there,

I’ve been trying to understand how libreoffice spawns it’s processes as I’d like to programatically move / resize their windows in an application I’m working on.

It seems like if I start a .exe like swriter.exe, it creates a child process soffice.exe and that creates a child process of soffice.bin.

If I look in the task manager, soffice.bin contains a LibreOffce Writer window / process but I can’t seem to get it’s process id in any way.

ATTACHED IS A PICTURE ILLUSTRATING MY ISSUE

Once again, my goal is just to get the process id of the swriter document window so I can do things like resize it programatically.

Thanks for checking out my question!

Best,

Nick

What do you mean you “can’t seem to get it’s process id in any way”? You have the screenshot where it’s clearly shown that asking for processed which parent is ProcessId 898052, you get process soffice.exe (PID=868156); asking for processes which ere its children gives you soffice.bin (PID 897900); and only when you ask for daughter processes of the latter, you get nothing (because soffice.bin rarely spawns other processes itself).

What we have here is a failure to communicate (Probably because I’m not entirely sure about the terminology). I’m not entirely sure what you call the windows that soffice.bin spawns. The windows that are listed in the screenshot under soffice.bin: i.e. the open documents. If I right click those documents under soffice.bin in the task manager… I can minimize/maximize them, bring them to the front, etc. I want to achieve this behavior programatically in a program I writing. Is this possible?

Use the UNO API that LibreOffice exposes. You may bind to it using a number of programming languages.

OTOH, you may use LO window classes to communicate using Windows messages, but this could be broken at any moment, because it’s not part of published API.

soffice.bin process is the sole owner of all its windows (multiple documents are all opened in that single process).

For details on programming, please join #libreoffice-dev IRC at FreeNode.