PRB: Using IDABORT with GetOpenFileName and GetSaveFileName

ID Number: Q85174

3.10

WINDOWS

docerr

Summary:

SYMPTOMS

If an application uses the IDABORT value to end the GetOpenFileName

or GetSaveFileName dialog box provided by the common dialog boxes

dynamic-link library (DLL), the application does not receive the

proper value.

RESOLUTION

Set the lCustData member of the OPENFILENAME structure to the

desired return value. If lCustData is used to transfer some other

data, use a global variable to pass the return value.

More Information:

The IDABORT value is documented on page 157 of the "Microsoft Windows

Software Development Kit: Programmer's Reference Volume 1: Overview"

manual as follows:

When a hook function posts the IDABORT value, the common dialog box

function returns the value contained in the low word of the lParam

parameter. For example, if the hook function for GetOpenFileName

called the PostMessage function with (LONG) 100 as the last

parameter, GetOpenFileName would return 100.

This information is not correct for the GetOpenFileName and

GetSaveFileName dialog boxes mentioned above. The information is

correct for all other modal dialog boxes provided by the common dialog

boxes DLL.

Specifying IDOK in the low-order word of lParam causes GetOpenFileName

and GetSaveFileName to return TRUE. Any other value causes these

functions to return FALSE.

Additional reference words: 3.10 COMMDLG.DLL