Opening a .NET form from an ABL window leaves a rogue proces

Posted by saquib on 17-Jan-2013 05:36

Hi,

I have an ABL application that has the following structure. Start.p calls the Login window which hides itself when a user logs in and re-appears when a user closes the main window:

start.p

  --> Login.w

       -->MainWindow.w

           -->.NETWrapper.p

                -->DotNetForm

                   -->Embedded ABL form

The .NET form has an ABL window embedded within it.

All the ABL windows are standard and use the standard WAIT-FOR:

  IF NOT THIS-PROCEDURE:PERSISTENT THEN
    WAIT-FOR CLOSE OF THIS-PROCEDURE.

When the ABL menu item for the .NET form is clicked a PCODE wrapper is run which contains the following code:

      lvDotNetForm = DYNAMIC-NEW MYFORM (INPUT {Embedded.w}).
                                                        
      /* Block for input */
      lvDotNetForm:show( ).


      WAIT-FOR System.Windows.Forms.Application:Run().


      DELETE OBJECT lvDotNetForm.

Everything seems to work fine and I can close the .NET window with no issues at all.

The problem arises when closing MainWindow.w with the DotNetForm form still open. This is the code which is called by MainWindow.w when it is closed to clean up any .NET forms that may still be open:

  rIForm = SESSION:FIRST-FORM.
  DO WHILE VALID-OBJECT( rIForm ):
    rForm = CAST(rIForm, DotNetForm) NO-ERROR.
    IF rForm <> ? THEN
    DO:

      rForm:Close().

       .........

The form is closed and the embedded ABL window subscribes to the form's 'close' event and calls its disable_UI procedure.

The .NET class's constructor is called and the object is destroyed.

Walking the widget tree shows that the ABL window has been destroyed.

The problem arises in that control does not return back the the login window and the task manager shows a process still running for the ABL session.

Just to re-iterate, there is no issue when closing the .NET form first and then the main window as control returns to the login window.

Please ask me if you need more information, I realise I may have been a bit brief.

Thankyou,

Saquib.

P.S. All the .w ABL windows are run persitently but the PCODE wrapper is not. I should also add that I've tried using:

  System.Windows.Forms.Application:Exit().

at various places in the app but with no success so far.

Message was edited by: Saquib Nisar - Added extra information.

All Replies

This thread is closed