Showing archive results for 2004

Oct 7, 2004
Post comments count0
Post likes count0

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

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 5, 2004
Post comments count0
Post likes count0

The macros for declaring and implementing COM interfaces

Raymond Chen

There are two ways of declaring COM interfaces, the hard way and the easy way. The easy way is to use an IDL file and let the MIDL compiler generate your COM interface for you. If you let MIDL do the work, then you also get __uuidof support at no extra charge, which is a very nice bonus. The hard way is to do it all by hand. If you choose th...

History
Oct 4, 2004
Post comments count0
Post likes count0

Those partisan non-partisan groups

Raymond Chen

Just because they say they're non-partisan doesn't mean that they're non-partisan. Friday night, I got a phone call from "Victor" at "Washington Counts" who came right out and asked me whom I was going to vote for. I asked him to repeat the name of the organization he represents, and he said, "Washington Counts, a non-partisan organization, wo...

Non-Computer
Oct 4, 2004
Post comments count0
Post likes count0

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

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

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

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 29, 2004
Post comments count0
Post likes count0

Still more goofy terms of service – restrictions on information disclosure

Raymond Chen

Part of the terms of the Continental Airlines OnePass Account Privacy rules seem unusually onerous. You are authorized to access OnePass account information solely to obtain information regarding your OnePass account and for no other purpose. You may not delegate or grant any power of attorney or other authorization regarding any such access. A...

Non-Computer
Sep 29, 2004
Post comments count0
Post likes count0

What does boldface on a menu mean?

Raymond Chen

On many context menus you will see an item in boldface. For example, if you right-click a text file, you will most likely see "Open" in boldface at the top of the mean. What does the boldface mean? The boldface menu item is the default command for that menu. It represents the action that would have occurred if you had double-clicked the item inst...

Tips/Support
Sep 28, 2004
Post comments count0
Post likes count0

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

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