PSM_ISDIALOGMESSAGE is to modeless property sheets as IsDialogMessage is to modeless dialog boxes


Dialog boxes and property sheets are similar in that most of the time, you use them modally. You call DialogBox or PropertySheet, and the function doesn't return until the user closes the dialog box or property sheet. But you can also use dialog boxes and property sheets modelessly, using CreateDialog or by including the PSH_MODELESS flag when you call PropertySheet.

One of the more common problems people have when managing a modeless property sheet is finding that keyboard navigation doesn't work. The reason is the same as with modeless dialog boxes: You forgot to process dialog messages.

But if you use the wrong function to process the dialog messages, then you don't get the right behavior.

If you get confused and use IsDialogMessage to process dialog messages for a property sheet, things will seem to work mostly okay, but most notably, the Ctrl+Tab and Ctrl+Shift+Tab keyboard shortcuts won't work. Those hotkeys are new to property sheets; those keys mean nothing special to dialog boxes, so the IsDialogMessage function won't do anything special if the user types them. There are other property sheet behaviors that go beyond plain dialog boxes, but the keyboard navigation among tabs is what users will probably notice first.

The other mix-up I've seen is sending the PSM_ISDIALOGMESSAGE message to a modeless dialog box, even though the dialog box isn't a property sheet. The PSM_ISDIALOGMESSAGE message is handled only by property sheets; if you send it to something else, who know what'll happen? Remember that PSM_ISDIALOGMESSAGE is in the WM_USER range, and messages in that range belong to the window class.

This is simply another case of keeping track of what you're doing and using the mechanism appropriate for what you have. You're already used to doing this in real life: If you travel to Canada and want to buy something from a vending machine, you have to put in Canadian money, not Turkish lira.

Comments (7)
  1. Joseph Bongaarts says:

    Unless at some point in time Turkish lira were minted with the same dimensions as a Canadian coin and people began to rely on that implementation detail. then we get stuck having to keep Canadian vending machines backwards compatible with Turkish lira forever…

  2. Bob Jones says:

    Keyboard navigation problems or no, I’m still not using any application that has modal dialogs.

  3. Lawrence says:

    @Bob Jones:

    Really, you won’t use any application that uses the standard File Open/Save dialog?

    Good luck with your development there, buddy!

  4. Worf says:

    US coins do usually work in Canadian vending machines… and I’d guess the vendors rely on that compatibility hack to generate a little extra money.

  5. Dove says:

    Why doesn’t my property sheet extension work under Vista even though it registers successfully from an elevated cmd prompt?

  6. Neil says:

    I’m confused. What happens when you open a property sheet from a modal dialog?

    If only the active window got to see all keyboard messages too then you could add the TranslateAccelerator processing to your window procedure, DefDlgProc would call IsDialogMessage, and the property sheet window procedure would call its equivalent, and we wouldn’t have to pollute the message loop. But I guess that’s a baked-in design flaw.

    [Um, this question is very confused. I’m not sure how to answer it. May I suggest brushing up on how message processing works in Windows. (And it’s not clear to me whether you’re talking about a modal or modeless property sheet. The question is meaningless if modal and confused if modeless.) -Raymond]
  7. Anonymous Coward says:

    Joseph Bongaarts, we’ve been there, sort of. When you fed a TL1 coin to some vending machines they recognized it as €2 – but it’s only worth about €0.40. Unsurprisingly, backwards compatibility was not maintained.

Comments are closed.

Skip to main content