Showing tag results for Code

Oct 18, 2004
Post comments count0
Post likes count0

Implementing higher-order clicks

Raymond Chen
Raymond Chen

Another question people ask is "How do I do triple-click or higher?" Once you see the algorithm for double-clicks, extending it to higher order clicks should be fairly natural. The first thing you probably should do is to remove the CS_DBLCLKS style from your class because you want to do multiple-click management manually. Next, you can simply...

Code
Oct 15, 2004
Post comments count0
Post likes count0

Logical consequences of the way Windows converts single-clicks into double-clicks

Raymond Chen
Raymond Chen

First, I'm going to refer you to the MSDN documentation on mouse clicks, since that's the starting point. I'm going to assume that you know the mechanics of how single-clicks are converted to double-clicks. Okay, now that you've read it, let's talk about some logical consequences of that article and what it means for the way you design your use...

Code
Oct 7, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 11 – Composite extensions – composition

Raymond Chen
Raymond Chen

Okay, now that we have two context menu handlers we want to compose (namely, the "real" one from the shell namespace and a "fake" one that contains bonus commands we want to add), we can use merge them together by means of a composite context menu handler. The kernel of the composite context menu is to multiplex multiple context menus onto a sin...

Code
Oct 4, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 9 – Adding custom commands

Raymond Chen
Raymond Chen

The indexMenu, idCmdFirst and idCmdLast parameters to the IContextMenu::QueryContextMenu method allow you, the host, to control where in the context menu the IContextMenu will insert its commands. To illustrate this, let's put two bonus commands on our context menu, with the boring names "Top" and "Bottom". We need to reserve some space in our ...

Code
Oct 1, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 8 – Optimizing for the default command

Raymond Chen
Raymond Chen

There is a small improvement that can be made to to the program we wrote last time. It involves taking advantage of the last parameter to the IContextMenu::QueryContextMenu method: CMF_DEFAULTONLY This flag is set when the user is activating the default action, typically by double-clicking. This flag provides a hint for the shortcut menu exte...

Code
Sep 30, 2004
Post comments count0
Post likes count1

How to host an IContextMenu, part 7 – Invoking the default verb

Raymond Chen
Raymond Chen

When we last left our hero, we were wondering how to invoke the default verb programmatically. Now that we've learned a lot about how IContextMenu is used in the interactive case, we can use that information to guide us in its use in the noninteractive case. The key here is using the HMENU to identify the default menu item and just invoke it d...

Code
Sep 28, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 6 – Displaying menu help

Raymond Chen
Raymond Chen

One of the subtleties of context menus is showing help in the status bar. Now, the program we've been developing doesn't have a status bar, so we'll fake it by putting the help text in the title bar. The key method for this task is IContextMenu::GetCommandString, which allows communication with a context menu handler about the verbs in the men...

Code
Sep 27, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 5 – Handling menu messages

Raymond Chen
Raymond Chen

One bug that was called out immediately in our first attempt at displaying the context menu to the user is that the Open With and Send To submenus don't work. The reason for this is that these submenus are delay-generated (which explains why they don't contain anything interesting when you expand them) and owner-drawn (which you can't notice ye...

Code
Sep 24, 2004
Post comments count0
Post likes count0

How to host an IContextMenu, part 4 – Key context

Raymond Chen
Raymond Chen

Another of the bugs you may have noticed in our first attempt at displaying the context menu to the user is that the Delete command doesn't alter its behavior depending on whether you hold the shift key. Recall that holding the shift key changes the behavior of the Delete command, causing it to delete a file immediately instead of moving it to ...

Code