A program for my nieces: The ABCs, part 4

Disabling autorepeat in my ABC program was largely sufficient to keep my nieces happy, given their instructions to press only one key at a time. Once in a while, though, they would hit the context menu key in the bottom right corner of the keyboard, and then they'd get stuck because they didn't know how to dismiss it.

So let's disable that key outright.

    HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
    UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
  switch (uMsg) {
    RemoveWindowSubclass(hwnd, EditSubclassProc, uIdSubclass);
  case WM_CHAR:
    if ((lParam & 0x40000000) && wParam != VK_BACK) return 0;
    return 0;
    return DefSubclassProc(hwnd, uMsg, wParam, lParam);

Well, that was awfully anticlimactic, wasn't it.

Comments (11)
  1. skSdnW says:

    What about adding a MessageBeep so they know when they are doing something "wrong"

  2. Jon says:


    Pressing the button does nothing, so it isn't interesting to them. They would rather play with the letters. If it made noise, and if they're anything like my kids or any others I know, it would quickly become their favorite button.

  3. skSdnW says:

    @Jon: If you are worried about the sound you could probably flash the background color or something, and yes, if it is _only_ for fun there is no point but learning to use computers/Windows at the same time cannot hurt…

  4. Such a tease! says:

    > Well, that was awfully anticlimactic, wasn't it.

    Like a spark following the dynamite fuse through the blasting cap and then nothing.

    The disappointment leaves you feeling unsatisfied and want to redo it with 3 sticks to make up for the bad one and compensate for the disappointment the first one left you with.

    Will there be more parts this week?

    Feeling unsatisfied and unable to relieve yourself with equal satisfaction is frustrating.

    Like have just watched a flashback filler episode of a good sci-fi tv series. As the credits appear you are left feeling cheated and made a fool of by getting hyped up from the previous episode.

    Leaves you with words that would make a censor work for its paycheck.

    Tried to do a Stephen Fry word rant and failed.

  5. JJJ says:


    Playing a beep or flashing a Windows teaches only "Don't touch that button!", which is not very instructive if your goal is to teach a little about how to use the computer.

    [The goal isn't even to teach about how to use a computer. The goal is to let the nieces enjoy "playing grown-up" by typing letters on a keyboard and putting letters (or for the oldest niece, words) on a screen. It's just a paperless typewriter. -Raymond]
  6. Joshua says:

    [The goal isn't even to teach about how to use a computer. The goal is to let the nieces enjoy "playing grown-up" by typing letters on a keyboard and putting letters (or for the oldest niece, words) on a screen. It's just a paperless typewriter. -Raymond]

    Welcome to the market of software for 3 year olds.

  7. cheong00 says:

    How about matching the hash of a dictionary that, if a word in the dictionary is inputted, it'd change color?

    [Feel free to add feature that yourself. I never found a need for it. -Raymond]
  8. Gabe says:

    JJJ: Have you never seen a toy for a small child? It seems like most toys have no point but to beep or flash when you press some button. If you make a special button that causes a beep or a flash, kids will push that button all day.

    If you think that making the beep more annoying will make them learn not to press the button, you're wrong — it will only make them push the button more frequently!

    And if it were me writing the program, I would make it as boring as possible. If it's too fun, kids will want to play it constantly, never letting me use my own damn computer. If they end up fighting over it, there's the risk it could be caught in the cross-fire. The key is to NOT turn the computer into a game.a

  9. Silly says:

    > Well, that was awfully anticlimactic, wasn't it.

    Heh. You should have waited until you were ready to quit blogging and made this your last post ever :)

  10. This disables the context menu completely, instead of just the context menu key. It also blocks right-click, and Shift-F10. It's possible and easy enough to modify this to still allow the context menu to be used with the mouse by checking lParam. If the keyboard is used, the mouse coordinates are reported as (-1, -1), and the message can be suppressed. Otherwise call DefSubclassProc. If Shift-F10 needs to be allowed too, some other approach is needed, probably looking at the keyboard messages. Although, allowing right-click while disallowing the context menu from the keyboard makes sense to me in a few situations, but allowing Shift-F10 while disallowing the context menu key does not.

    (I realise that this won't be necessary for what you have in mind, and blocking the context menu entirely won't be a problem for you. I'm not trying to suggest it is.)

  11. John Doe says:

    The lesson here is "80% of your time will be taken by 20% of the unexpected mid-term requested/required features".

    Imagine if you didn't know about WM_CONTEXTMENU, a very plausible situation when you haven't read the whole Win32 reference. What would be your first approach?

    Perhaps most people would be interested in muffling the input that pops the context menu, to only find out later that there's a message dedicated to do it, and now you'll roll back and replace all that hard work with two lines.

    Of Course™, this wouldn't happen had you read the whole introductory section "About Menus".

Comments are closed.

Skip to main content