Your program first needs to load the DCL file using the load_dialog function. This function searches for dialog files according to the AutoCAD support file search path, unless you specify a full path name.
;; Load the dialog box. Set up error checking to make sure
;; the dialog file is loaded before continuing
(if (= -1 (setq dcl_id (load_dialog "gpdialog.dcl")))
;; There's a problem - display a message and set the
;; dialogLoaded flag to nil
(princ "\nCannot load gpdialog.dcl")
(setq dialogLoaded nil)
) ;_ end of progn
) ;_ end of if
The dialogLoaded variable indicates if the dialog loaded successfully. In the code where you set up the initial values for the dialog box, you set dialogLoaded to an initial value of T. As you can see in the code fragment above, dialogLoaded is set to nil if there is a problem with the load.