View previous topic :: View next topic |
Author |
Message |
johannes
Joined: 21 Jan 2011 Posts: 65 Location: Leimen, Germany
|
Posted: Thu Nov 24, 2011 6:57 pm Post subject: Closing winapp Output window |
|
|
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? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Fri Nov 25, 2011 6:52 pm Post subject: |
|
|
The help file says use create_window@ and destroy_window@.
Code: | 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 |
|
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Sat Nov 26, 2011 12:16 pm Post subject: |
|
|
Typically, if you do not open the OUTPUT window explicitly, you can still close it with the following code example Code: | 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
|
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Sun Nov 27, 2011 9:23 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|