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

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

Here is a Java example from [Solved] Get the Window Handle of a document ? (View topic) • Apache OpenOffice Community 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.com/api-dev-How-to-minimize-whole-OpenOffice-window-td2766491.html.

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

Documentation: getWindowHandle.

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

I added a Basic example and a link to documentation.