Ask Your Question

How to get window handle for libreoffice writer document from VB.Net dll?

asked 2017-12-11 19:06:44 +0200

Muru gravatar image

Please any one provide me code to get window handle for libre office document from DLL?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-12-12 10:39:17 +0200

Jim K gravatar image

updated 2017-12-12 11:19:04 +0200

Here is a Java example from

XModel model = (XModel) UnoRuntime.queryInterface(XModel.class, xSpreadsheetDocument);
XController c = model.getCurrentController();
XFrame frame = c.getFrame();
XWindow window = frame.getContainerWindow(); 
XSystemDependentWindowPeer  xWindowPeer = (XSystemDependentWindowPeer) UnoRuntime.queryInterface(XSystemDependentWindowPeer.class, window);
int handle = (Integer) xWindowPeer.getWindowHandle("".getBytes(), SystemDependent.SYSTEM_WIN32);

It's up to you to translate this into _VB.Net_. If you encounter a specific problem while attempting to translate it, then describe the problem and we can help.


Here is example Basic code from http://openoffice.2283327.n4.nabble.c....

handle = window.getWindowHandle(dimarray(), 1) ' 1=WIN32

Documentation: getWindowHandle.

edit flag offensive delete link more


Thanks for your solution.

I have tried this and i could not get the process id then passed to first parameter of procedure getWindowHandle. So can you please let me know what the value should pass in first parameter of below line? if possible, provide me some code.

int handle = (Integer) xWindowPeer.getWindowHandle("".getBytes(), SystemDependent.SYSTEM_WIN32);

Muru gravatar imageMuru ( 2017-12-12 10:46:44 +0200 )edit

I added a Basic example and a link to documentation.

Jim K gravatar imageJim K ( 2017-12-12 11:17:28 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-12-11 19:06:44 +0200

Seen: 250 times

Last updated: Dec 12 '17