Dialog Function: Displays a modeless dialog box.
Module: USE IFLOGM
Syntax
result = DLGMODELESS (dlg [, nCmdShow, hwndParent])
dlg
(Input) Derived type dialog
. Contains dialog box parameters. The components of the type dialog
are defined with the PRIVATE attribute, and cannot be changed or individually accessed by the user. The variable passed to this function must remain in memory for the duration of the dialog box, that is from the DLGINIT call through the DLGUNINIT call.
The variable can be declared as global data in a module, as a variable with the STATIC attribute, or in a calling procedure that is active for the duration of the dialog box. It must not be an AUTOMATIC variable in the procedure that calls DLGMODELESS.
nCmdShow
(Input) Integer. Specifies how the dialog box is to be shown. It must be one of the following values:
Value | Description |
---|---|
SW_HIDE | Hides the dialog box. |
SW_MINIMIZE | Minimizes the dialog box. |
SW_RESTORE | Activates and displays the dialog box. If the dialog box is minimized or maximized, the Windows system restores it to its original size and position. |
SW_SHOW | Activates the dialog box and displays it in its current size and position. |
SW_SHOWMAXIMIZED | Activates the dialog box and displays it as a maximized window. |
SW_SHOWMINIMIZED | Activates the dialog box and displays it as an icon. |
SW_SHOWMINNOACTIVE | Displays the dialog box as an icon. The window that is currently active remains active. |
SW_SHOWNA | Displays the dialog box in its current state. The window that is currently active remains active. |
SW_SHOWNOACTIVATE | Displays the dialog box in its most recent size and position. The window that is currently active remains active. |
SW_SHOWNORMAL | Activates and displays the dialog box. If the dialog box is minimized or maximized, the Windows system restores it to its original size and position. |
The default value is SW_SHOWNORMAL.
hwndParent
(Input) Integer. Specifies the parent window for the dialog box. The default value is determined in this order:
Results
The result type is LOGICAL(4). The value is .TRUE. if the function successfully displays the dialog box. Otherwise the result is .FALSE..
During execution, DLGMODELESS displays a modeless dialog box and returns control to the calling application. The dialog box remains active until DLGEXIT is called, either explicitly or as the result of the invocation of a default button callback.
DLGMODELESS is typically used in a Windows application. The application must contain a message loop that processes Windows messages. The message loop must call DLGISDLGMESSAGE for each message. See the example below. Multiple modeless dialog boxes can be displayed at the same time. A modal dialog box can be displayed from a modeless dialog box by calling DLGMODAL from a modeless dialog callback. However, DLGMODELESS cannot be called from a modal dialog box callback.
DLGMODELESS also can be used in a Console, DLL, or LIB project. However, the requirements remain that the application must contain a message loop and must call DLGISDLGMESSAGE for each message. For an example of calling DLGMODELESS in a DLL project, see the Dllprgrs sample in the ...\SAMPLES\DIALOG
folder.
Use the DLG_INIT callback with DLGSETSUB to perform processing immediately after the dialog box is created and before it is displayed, and to perform processing immediately before the dialog box is destroyed.
Compatibility
WINDOWS CONSOLE DLL LIB
See Also
DLGSETSUB, DLGINIT, DLGEXIT, DLGISDLGMESSAGE, Building Applications: Using a Modeless Dialog Box
use IFLOGM
include 'resource.fd'
type (DIALOG) dlg
type (T_MSG) mesg
integer*4 ret
logical*4 lret
...
! Create the main dialog box and set up the controls and callbacks
lret = DlgInit(IDD_THERM_DIALOG, dlg)
lret = DlgSetSub(dlg, IDD_THERM_DIALOG, ThermSub)
...
lret = DlgModeless(dlg, nCmdShow)
...
! Read and process messsages
do while( GetMessage (mesg, NULL, 0, 0) )
! Note that DlgIsDlgMessage must be called in order to give
! the dialog box first chance at the message.
if ( DlgIsDlgMessage(mesg) .EQV. .FALSE. ) then
lret = TranslateMessage( mesg )
ret = DispatchMessage( mesg )
end if
end do
! Cleanup dialog box memory and exit the application
call DlgUninit(dlg)
WinMain = mesg%wParam
return