Calling Unlinked Dialog Boxes

When QuickCase:W adds an unlinked dialog box to an application, it creates a section of nonexecuting code between the end of the WinMain function and the beginning of the WinProc function. This code is to be cut from its current location and pasted into your code where you want to call the dialog box.

The following example shows the code QuickCase:W generates to call an unlinked dialog box saved in a resource file named TESTDB.DLG. The dialog resource was created with the Dialog Editor described in Chapter 1.

/* The following Dialog box calls are generated for the dialog boxes */

/* that have been selected as Unlinked dialog boxes. To use these */

/* calls, simply copy them to the appropriate location in the */

/* application. */

#if 0

{

FARPROC lpfnTESTDBMsgProc;

lpfnTESTDBMsgProc = MakeProcInstance((FARPROC)TESTDBMsgProc, hInst);

nRc = DialogBox(hInst, (LPSTR)"TESTDB", hWnd, lpfnTESTDBMsgProc);

FreeProcInstance(lpfnTESTDBMsgProc);

}

#endif

In practice, you would remove the introductory comments and the #if and #endif statements and then move the remaining code to the part of the program that calls the dialog box.