Reference Manual

  • 15.0
  • 07/23/2021
  • Public Content
Contents

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*.
  1. 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.
  2. 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:
    1. Delete the
      Cancel
      button (click the
      Cancel
      button and press the
      Delete
      key).
    2. Add a new static text control to the dialog box.
    3. Enlarge or resize the static text control if needed.
    4. 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.
    5. Dismiss the dialog box by clicking the x in the upper-right corner of the window.
  3. In the
    File
    menu, select
    Save All
    .
  4. In the
    Project
    menu, select
    Add Existing Item....
    Change the
    Files of Type:
    selection to
    All Files
    and select Resource.h. Click
    Open
    .
  5. Select the Resource.h file in the Solution View and the select
    View>Property Pages
    .
  6. Set the options as follows:
    • Command Line: deftofd resource.h resource.fd.
    • Description: Generating Fortran include file...
    • Outputs: resource.fd.
  7. Click
    OK
    .
  8. 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.
  9. Build the Hellodlg Fortran Console project application. When you execute the application, the dialog box you created appears in front of the Console window:
    displayed output from hellodlg project
  10. 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.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.