QCW9201002: Dialog Box Not Displayed If Given Name and Number

ID Number: Q79817

1.00

WINDOWS

buglist1.00

Summary:

PROBLEM ID: QCW9201002

SYMPTOMS

In Microsoft QuickC for Windows (QC/Win) version 1.0, if a dialog

box created in the Dialog Editor is given both a symbolic name and

a number, it will not display when linked to a menu item in

QuickCase:W (QCase:W).

After a project has been created and built using the Dialog Editor,

QCase:W, and QC/Win, the program will run. When the menu item

linked to the dialog box is selected with the mouse, the item will

highlight. However, the dialog box will not display.

CAUSE

The cause of the problem is that the program uses the symbolic name

of the dialog box in the call to the DialogBox function. This same

name is used in the .DLG file as the label for the DIALOG

statement.

However, the .H file for the dialog box contains a line defining

the symbolic name as a numeric constant. When the resource compiler

compiles the .RC file for the dialog box, the .DLG file and the .H

file are included, and the number is substituted for the name. The

program cannot find the dialog box because it calls for it by name

and the load fails.

RESOLUTION

To correct the problem so that the dialog box displays, edit the

dialog box using the Dialog Editor. First delete the current Dialog

Symbol and then add a new one without a number. The steps are as

follows:

1. Invoke the Dialog Editor.

2. Choose Open from the File menu.

3. Select the .RES file for the dialog box to be edited.

4. With the mouse, select the dialog by clicking the title bar. Note

the name appearing in the Dlg. Sym. box.

5. Choose Symbols from the Edit menu.

6. Select the symbol for the dialog box (the same name that is in the

Dlg. Sym. box.)

7. Choose Delete. The symbol will be erased.

8. Choose OK.

9. Select the Dlg. Sym. box with the mouse (it will be empty). Enter

a name (the same one previously used is fine). There should be no

number in the box to the right.

10. Save the dialog box and exit the Dialog Editor.

11. Rebuild the program (you do not have to do anything in QCase:W).

STATUS

Microsoft has confirmed this to be a problem in QC/Win version 1.0.

We are researching this problem and will post new information here

as it becomes available.

More Information:

To re-create the problem, do the following:

1. In the Dialog Editor, create a new dialog box and enter a name in

the Dlg. Sym. box. Press the TAB key and enter a number in the

small box to the right of the Dlg. Sym. box. Save the dialog box.

You will have to give both the name of the .H file and the .RES

file. These should be the same. Exit the Dialog Editor.

2. In QCase:W, choose New from the File menu. Enter a menu item by

clicking the <<>> symbol. Enter a name and change the "Link to"

entry to "Dialog Box". Then select Configure Link and link the menu

item to your dialog box. Save the prototype (it must have a

different name than the dialog box) and generate the source code.

Close QCase:W.

3. In QC/Win, open the project and build it. Run the program. Select

the menu item for the dialog box. Nothing will happen, except that

the menu item will "flash" as it is highlighted.

Example

-------

The program contains following line to create the dialog box:

nRc = DialogBox(hInst, (LPSTR)"dlgname", hWnd, lpfnFILEMsgProc);

The DLGNAME.H file contains the line:

#define dlgname 1

In this case, DLGNAME was typed in the Dlg. Sym. box and "1" was the

number inserted in the (unlabeled) symbol number box to the right of

the Dlg. Sym. box.

The DLGNAME.DLG file resembles the following (in part):

DLGINCLUDE RCDATA DISCARDABLE

BEGIN

"DLGNAME.H\0"

END

dlgname DIALOG 6, 18, 160, 100

At build time the DIALOG statement becomes:

1 DIALOG 6, 18, 160, 100

This would be more consistent with a call to DialogBox that read:

nRc = DialogBox(hInst, MAKEINTRESOURCE(1), hWnd, lpfnNUMBERMsgProc);

Additional reference words: 1.00 qcw qcwin