# DLGINIT, DLGINITWITHRESOURCEHANDLE (W*S)

Dialog Functions: Initialize a dialog box.

## Module

USE IFLOGM

result = DLGINIT (id,dlg)

result = DLGINITWITHRESOURCEHANDLE (id,hinst,dlg)

id | (Input) INTEGER(4). Dialog identifier. Can be either the symbolic name for the dialog or the identifier number, both listed in the Include file (with extension .FD).
dlg | (Output) Derived type `dialog`. Contains dialog box parameters.
hinst | (Input) INTEGER(HANDLE). Handle of the module instance in which the dialog resource can be found. INTEGER(HANDLE) is INTEGER(4) on IA-32 architecture and INTEGER(8) on Intel® 64 architecture.

## Results

The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, the result is .FALSE..

DLGINIT must be called to initialize a dialog box before it can be used with DLGMODAL, DLGMODELESS, or any other dialog function.

DLGINIT will only search for the dialog box resource in the main application. For example, it will not find a dialog box resource that has been built into a dynamic link library.

DLGINITWITHRESOURCEHANDLE can be used when the dialog resource is not in the main application. If the dialog resource is in a dynamic link library (DLL), hinst must be the value passed as the first argument to the DLLMAIN procedure.

Dialogs can be used from any application, including console, QuickWin, and Windows* applications.

## Example

    USE IFLOGM
    INCLUDE 'DLG1.FD'
    LOGICAL retlog
    TYPE (DIALOG) thisdlg
    ...
    retlog = DLGINIT (IDD_DLG3, thisdlg)
    IF (.not. retlog) THEN
      WRITE (*,*) 'ERROR: dialog not found'
    ELSE
    ...

Parent topic: Dialog Library Routines

## See Also

DLGEXIT
DLGMODAL
DLGMODELESS
DLGUNINIT