Visible to Intel only — GUID: GUID-13C5932B-A2E3-4DE0-83AE-75BAAC8B1037
Visible to Intel only — GUID: GUID-13C5932B-A2E3-4DE0-83AE-75BAAC8B1037
Using Fortran AppWizards to Help Add Modal Dialog Box Coding
When an application displays a modal dialog box, the user must explicitly enter data and close the dialog box before the application resumes execution. Any Fortran project type can use a modal dialog box.
The following creates a "Hello World" Fortran Console application that uses a modal dialog box to display "Hello World!" The first step may vary, depending on your version of Visual Studio*.
From the list of Fortran project types, select Console Application. In the right pane, select Main Program Code. At the bottom of the window, specify a file name (HelloDlg) and location. Your project and source file (HelloDlg.f90) will be created for you.
In the File menu, select Add New Item... and select Resource. Specify a name of HelloDlg.rc and click Open. Select Edit>Add Resource..., select Dialog, and click New. Create the box using the dialog resource editor, as follows:
Delete the Cancel button (click the Cancel button and press the Delete key).
Add a new static text control to the dialog box.
Enlarge or resize the static text control if needed.
Select the static text control, then select View>Properties Window or (right-click and choose Properties) to edit its properties. Change the Caption to "Hello World!." You may also want to change the Align Text option to Center.
Dismiss the dialog box by clicking the x in the upper-right corner of the window.
In the File menu, select Save All.
In the Project menu, select Add Existing Item.... Change the Files of Type: selection to All Files and select Resource.h. Click Open.
Select the Resource.h file in the Solution View and the select View>Property Pages.
Set the options as follows:
Command Line: deftofd resource.h resource.fd.
Description: Generating Fortran include file...
Outputs: resource.fd.
Click OK.
Edit the file HelloDlg.f90 as follows:
After the program HELLODLG line, add the following line:
USE IFLOGM
Replace the line: print *, 'Hello World'
With the following lines:
include 'resource.fd' type (DIALOG) dlg logical lret integer iret lret = DlgInit(IDD_DIALOG1, dlg) iret = DlgModal(dlg) call DlgUninit(dlg)
In the code above:
The USE IFLOGM line includes the IFLOGM module interfaces to the Dialog routines.
The line include 'resource.fd'The Include (.FD and .H) Files.
The function reference to DLGINIT initializes the dialog box.
The function reference to DLGMODAL displays the dialog box.
The call to DLGUNINIT frees the dialog box resources.
Build the Hellodlg Fortran Console project application. When you execute the application, the dialog box you created appears in front of the Console window:
Click OK to dismiss the dialog box.
For Intel Visual Fortran applications using the Fortran Windows project type, you can use the Fortran Windows Project AppWizard to help you add dialog coding for a Using Fortran AppWizards to Help Add Modeless Dialog Box Coding.
For information about coding requirements for modal and modeless dialog boxes, see Initializing and Activating the Dialog Box.