Silverfrost Forums

Welcome to our forums

Closing winapp Output window

24 Nov 2011 5:57 #9288

Hello Forum, winapp is creating a white window called 'Output', where all the print * lines show up. However, this window does not close automatically neither at END nor STOP. This may be fine for inspection of the test prints, but I want an automatic close and disappear of the window at end of the run. How can this be achieved?

25 Nov 2011 5:52 #9300

The help file says use create_window@ and destroy_window@.

winapp
program main
include <windows.ins>
ih = create_window@('Output',100,100,400,400)
call open_to_window@(7, ih)
write(7,*) 'Hello World'
ic = win_getchar@(ih)
call destroy_window@(ih);
end
26 Nov 2011 11:16 #9304

Typically, if you do not open the OUTPUT window explicitly, you can still close it with the following code example i = winio@ ('%mn[[E&xit]]&', exit_func)

integer*4 function exit_func()
!
    call close_output_window
!
    exit_func = 0    !   Setting the return value to zero will exit the program.

end function exit_func

     subroutine close_output_window
!
      INCLUDE <windows.ins>
!
      integer*4 hwnd
      logical   L
!
!   Get the handle for the 'Output' window
      hwnd = FindWindow('SalfordClass', 'Output')
      write (98,*) hwnd,' = FindWindow('SalfordClass', 'Output')'
      if (hwnd < 1) return
      L    = DestroyWindow (hwnd)
      write (98,*) L,   ' = DestroyWindow(hwnd)'
!
      end subroutine close_output_window
27 Nov 2011 8:23 #9306

These two approaches are compatible and equivalent.

destroy_window@ calls DestroyWindow and the handle returned by create_window@ is the same as the one that is found using FindWindow.

You can use either approach or mix/merge at will.

Please login to reply.