Displaying child window from a callback routine

Displaying child window from a callback routine

I will appreciate help with the following.
I am using CVF Standard edition 6.1A on Windows 98. The following is a simplified version of a program I am writing. The subroutine testch opens a child window and displays the message "press enter to continue". The child window opens and closes without problems both times when called from withing the program Main. However, when the subroutine testch is called from within the callback routine Menu2, the program hangs and does not respond to any input while the child window remains behind the dialog box from where it was called.
Is it possible to display a child window from a call back routine? What am I missing in my program?

Oscar H.

program Main
use dflogm
implicit none
include 'resource.fd'

type (dialog) dlg
logical lret

external Menu1, Menu2

call testch
close( unit=11, status = 'delete' )

lret = DlgInit( IDD_DIALOG1, dlg )
lret = DlgSetSub( dlg, IDC_BUTTON1, Menu1 )
lret = DlgSetSub( dlg, IDC_BUTTON2, Menu2 )
lret = DlgModal( dlg )

call testch
close( unit=11, status = 'delete' )
end program Main

subroutine Menu1( dlg, id, callbacktype )
use dflogm
implicit none
type (dialog) dlg
integer id, callbacktype
include 'resource.fd'
logical lret
lret = DlgSet( dlg, IDC_OPTION, 'Menu1 Selected' )
end subroutine Menu1

subroutine Menu2( dlg, id, callbacktype )
use dflogm
implicit none
type (dialog) dlg
integer id, callbacktype
include 'resource.fd'
logical lret
lret = DlgSet( dlg, IDC_OPTION, 'Menu2 Selected' )
!!!!The programs hangs at the next statement: !!!!
call testch
close( unit=11, status = 'delete' )
end subroutine Menu2

subroutine testch
use dflib
open (11,file="user")
write(11,*) "Press Enter to continue"
read (11,*)
end subroutine testch

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.