Ask Your Question
0

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

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

Muru gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

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

Jim K gravatar image

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

Here is a Java example from https://forum.openoffice.org/en/forum....

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.

EDIT:

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

Comments

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 +0100 )edit

I added a Basic example and a link to documentation.

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

Question Tools

1 follower

Stats

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

Seen: 132 times

Last updated: Dec 12 '17