Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

Dialog-base process will not terminate

isn-removed200637
385 Views
I use compaq 6.6b .
I have written a Dialog-box based application that apparently quits OK (the dialog box vanishes) when both the IDOK or IDCANCEL button is used, also
when the 'close' button on the system menu is pressed, but the process remains active in Task manager, so I cannot update the executable as Dev Studio marks it as being used. What's the cause? Here is the WinMainmessage loop and how the dialog box call-back BeginSub deals with its messages:
 lret = DlgModeless(gdlg, nCmdShow)
if (lret == .FALSE.) goto 99999
! Read and process messsages
do while( GetMessage (mesg, NULL, 0, 0) )
if ( DlgIsDlgMessage(mesg) .EQV. .FALSE. ) then
lret = TranslateMessage( mesg )
ret = DispatchMessage( mesg )
end if
end do
call DlgUninit(gdlg)
WinMain = mesg.wParam
return
99999 &
ret = MessageBox(ghwndMain, "Error initializing application MULTILAYER"C, &
"Error"C, MB_OK)
WinMain = 0
end
!****************************************************************************
!
! FUNCTION: BeginSub ( dlg, id, callbacktype )
!
! PURPOSE: Dialog box callback for initialization and destroy
!
! COMMENTS:
!
!****************************************************************************
SUBROUTINE BeginSub( dlg, id, callbacktype )
!DEC$ ATTRIBUTES DEFAULT :: BeginSub
use dfwin
use dfwinty
use dflib
use MULTILAYERGlobals
use user32
use xflogm
implicit none
include 'resource.fd'
!****************************************************************

INTEGER*4 NINM, INM
INTEGER*4 LENGTH, RETINT, iflag, IMATERIAL
CHARACTER($MAXPATH) MESSAGE

type (dialog) dlg
integer id, callbacktype
LOGICAL retlog
LOGICAL*4 LCHECK, FEXIST
if (callbacktype == dlg_destroy) then
call PostQuitMessage(0)
elseif (callbacktype == dlg_init) then
(Note that I use Jugoslav Djugic's XFLOGM in place of DFLOGM as Idraw toan OWNER_DRAW control in a dialog box).
Any help appreciated
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
385 Views

Maybe because XFLOGM does not support DLG_DESTROY :smileywink: so thePostQuitMessage is never called...

The workaround is simple. Actually, dialog-based application created with AppWizard is overcomplicated. It should be plain:

integer WinMain(...
call DlgInit(...)
iret = DlgModal(...)
call DlgUninit(...
WinMain = 0

end function

You need modeless dialog and message loop only if you plan to launch modeless WS_POPUP dialogs other than the main one.

XFLOGM 2.0 (coming real soon now, just if I find few hours to dig my head out of regular job ) should support everything in DFLOGM 6.6/IVF8 (and then some).

Jugoslav
0 Kudos
isn-removed200637
385 Views

Thanks Jugoslav.

Changing from Modeless to Modal and commenting out the message loop

works fine, after changing back from dflogm to xflogm.

Does your last sentence indicate modeless dialogs will also soon be

supported in XFLOGM?

Again, many thanks, the code for drawing to a control is really neat.

Best regards from

Tony Richards

0 Kudos
Reply