Problems Subclassing the Find and Replace Common Dialogs

The Find and Replace common dialog boxes operate differently than all other common dialog boxes in one respect. These common dialogs are modeless. This means that code will continue executing in the calling procedure; it will not wait for the dialog to be closed. For a modeless dialog to work properly, Windows requires that the IsDialogMessage API function be used in the main message loop of the application. The IsDialogMessage API function basically does the work of the TranslateMessage and the DispatchMessage API functions, but for modeless dialog boxes. Therefore, if IsDialogMessage returns a TRUE value, it has processed the message and the TranslateMessage and the DispatchMessage API functions should not be called. The IsDialogMessage API function’s main purpose is to provide default dialog keyboard processing for the modeless dialog box. Modal dialog boxes automatically support default dialog keyboard processing. Here is the list of default dialog keyboard keys processed by the IsDialogMessage API function:

ALT+mnemonic

Moves the focus to the first control in the tab order after the static control containing this mnemonic

DOWN

Moves the focus to the next control

UP

Moves the focus to the previous control

ENTER

Simulates clicking the OK button

ESC

Simulates clicking the Cancel button

LEFT

Moves the focus to the previous control

RIGHT

Moves the focus to the next control

TAB

Moves the focus to the next control

SHIFT+TAB

Moves the ...

Get Subclassing and Hooking with Visual Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.