Re-parent component – Comp App Catalog

We have a request from a pretty large customer to provide a PCOMM component for composite applications. I used the Reparent component from Jo's component catalog to get started. It was very easy to get going for a proof of concept.

I also had to make a change to code because for some reason this application get re-parented incorrectly.

In NativeAppViewer.java


public void connect()
{
List oldTopWindows = getTopWindows();
if (!launchApplication())
return;
if (!findApplication(oldTopWindows))
return;
// Save the window style
mOldStyle = OS.GetWindowLong(mHandle, OS.GWL_STYLE);
// Set style to remove border and title
OS.SetWindowLong(mHandle, OS.GWL_STYLE, OS.WS_VISIBLE|OS.WS_CLIPCHILDREN|OS.WS_CLIPSIBLINGS);
// Reset parent and remember the original parent
mPriorParent = OS.SetParent(mHandle, mClient.handle);
System.out.println(" reparenting "+Integer.toHexString(mHandle)+" from "+Integer.toHexString(mPriorParent)+" to us "+Integer.toHexString(mClient.handle));
Thread t = new Thread() { public void run() {

//New code here
OS.SetWindowPos(mHandle, OS.HWND_TOP, 0, 0, 0, 0, OS.SWP_NOSIZE);

mClient.redraw();
}
};
mClient.getDisplay().asyncExec(t);
}

Here it is running in Lotus Notes:

Tags: : : :

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.