Re-parenting Progress' main window

My goal is to create a .Net application that "hosts" multiple legacy Progress applications. The idea is to create a tab deck where a panel on each tab deck host a re-parented Progress runtime. I have been able to to this successfully with another .Net application as the re-parented application.

The logic is to have the Progess application receive as an argument the parent's HWND. Then the Progress application sends a windows message back to the parent app with a payload of the Progress app's HWND. The parent then calls SetParent to host the Progress app in one of it's panels on a tab.

I actually have most of this working. but the problem I have is finding the HWND of the Progress runtime main window.

I have tried a few things... but DEFAULT-WINDOW:HWND doesn't seem to be it.

Can someone point me in a direction? Thanks.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I alos have problem most of

I alos have problem most of time working. but the problem I have is finding the HWND of the Progress runtime main window.

--------------------------------
fathers child support rights


Help me in .Net code

Could you please share .net code how to make call to progress and usage of message passed from progress,and how to reparent progress window into panel.

Thanks in Advance
Soji


There are a couple of

There are a couple of 'undocumented' properties in 10.X, I am not sure after what version they came up nor what the properties exactly do; it seems it has to do with the re-parenting done by the UIB with the Eclipse Window for the OpenEdge Architect. I found the code in adeuib\_attr-ed.w.

It seems something that might help you.

Let us know your findings!

Greetz,
Ildefonzo


/* OpenEdge IDE
* This code is now using the IDE-WINDOW-TYPE and IDE-PARENT-HWND attributes,
* however, the embedded mode can only be specified at creation time, so we needed
* to create the window again because these parameters are not available to
* the AppBuilder.
*/
IF OEIDEIsRunning THEN
DO:
DEFINE VARIABLE cViewId AS CHARACTER NO-UNDO.
DEFINE VARIABLE cSecondaryId AS CHARACTER NO-UNDO.
DEFINE VARIABLE cViewTitle AS CHARACTER NO-UNDO.
DEFINE VARIABLE iViewHwnd AS INTEGER NO-UNDO.

DELETE OBJECT properties_window NO-ERROR.
ASSIGN cViewId = "com.openedge.pdt.text.views.OERuntimeView"
cSecondaryId = "PropertiesWindow_" + getProjectName()
cViewTitle = "Properties Window".

/* Show view */
showView(cViewId, cSecondaryId, {&VIEW_ACTIVATE}).
setViewTitle(cViewId, cSecondaryId, cViewTitle).
RUN getViewHwnd IN hOEIDEService (cViewId, cSecondaryId, OUTPUT iViewHwnd) NO-ERROR.

CREATE WINDOW properties_window ASSIGN
IDE-WINDOW-TYPE = 0 /* embedded mode */
IDE-PARENT-HWND = iViewHwnd
HIDDEN = YES
TITLE = "Properties Window"
HEIGHT = 10
WIDTH = 42.4
MAX-HEIGHT = 34.33
MAX-WIDTH = 204.8
VIRTUAL-HEIGHT = 34.33
VIRTUAL-WIDTH = 204.8
RESIZE = yes
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
KEEP-FRAME-Z-ORDER = yes
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.


jurjen's picture

interesting undocumented attribs

Interesting, thanks Ildefonzo!

I have just tried a quick test with these attribs:
IDE-WINDOW-TYPE = 0 /* embedded mode */
IDE-PARENT-HWND = iViewHwnd
to glue the window to a .NET panel and it appears to work.

It is a bit funny that the window can be moved and resized in its new parent panel, I would have expected that the window would get something with the effect of Dock=DockStyle.Fill

When the Progress window is smaller than the parent panel, then I would expect to get scrollbars, but instead the form is just clipped. Strange.

Strange, it needs some tweaking, but it is still interesting.


iViewHwnd ?

Jurjen,
How are you communicating the .Net containers Hwnd to the Progress application?
Thanks.


jurjen's picture

re: iViewHwnd ?

> How are you communicating the .Net containers Hwnd to the Progress application?

The panel has a .Handle attribute which is an IntPtr to the hwnd. Unfortunately I don't have enough .Net knowledge to get the hwnd value from the pointer.


I've been able to get this

I've been able to get this working by calling the Progress app with... -param ParentHWND

DEFINE VARIABLE hParent AS INTEGER NO-UNDO.
RUN GetParent(C-Win:HWND, OUTPUT hParent).
/* Pass the handle of our Progress Client to the handle that was passed to us*/
RUN SendMessageA(INT(SESSION:PARAMETER),{&WM_USER},hParent,0).

The .Net app then re-parents the window in one of it's panels and hides the Progress Clients caption.

This seems to work just fine, however sending a WM_CLOSE to the Progress app when the .Net app closes seems not to close the prowin32.exe... I have to kill the prowin32.exe process.

Am I building a rickety cart here???


jurjen's picture

Restore the original parent on WM_CLOSE ?

I don't know, but would it work when the .NET application first remembers the oldparent=GetParent(progresswindow) result before it reparents the progresswindow.

Then, on WM_CLOSE of the .NET window, first restore the oldparent with SetParent(progresswindow, oldparent), then restore the caption if you hid it, and finally PostMessage(progresswindow, WM_CLOSE).

I guess that PostMessage works better than SendMessage with WM_CLOSE in this case -- it is just a gut feeling.


Thanks Jurjen I will try it

Thanks Jurjen I will try it out.

In your opinion am I crazy to try this? It seems to work so that we can create a .Net menu shell, call legacy apps, and create new OpenClient apps... that all appear hosted by the shell in tab decks.

Just worried I am playing with fire here :-)

Again Thanks.