How to get the process id of the document window [closed]

asked 2018-04-02 17:03:29 +0200

Nickprovs gravatar image

updated 2020-07-14 15:47:33 +0200

Alex Kemp gravatar image

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.


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!



image description

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2021-05-04 14:53:22.972110


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

Mike Kaganski gravatar imageMike Kaganski ( 2018-04-02 20:41:58 +0200 )edit

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?

Nickprovs gravatar imageNickprovs ( 2018-04-02 21:15:17 +0200 )edit

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.

Mike Kaganski gravatar imageMike Kaganski ( 2018-04-02 21:53:47 +0200 )edit