In order to do drag-drop rearrangement of menus,
you need four things, most of which we already know how to do.
Dragging an item out of a menu.
Dropping an item into a menu.
Connecting the drag with the drop.
we looked at using the MNS_DRAGDROP style
for dragging items out of a menu.
Today, we’ll look at dropping them in.
Take the program from last time and make the following additions.
First, let’s add a second item to the menu.
Windows 2000 introduced the MNS_DRAGDROP menu
style, which permits drag/drop operations in a menu.
Nobody uses this style, probably because it’s totally undiscoverable
by the end-user.
But I’ll write a sample program anyway.
Mind you, I knew nothing about the MNS_DRAGDROP
menu style until I started writing this entry.
Over the years, I’ve seen a bunch of coding anti-patterns.
I figured maybe I’ll share a few.
Today, I’ll introduce
what I’m calling the for-if anti-pattern,
also known as
“We’ll sell you the whole seat, but you’ll only need the edge.”
The Washington State Ferry system has reduced the rated carrying capacity of its fleet because people have gotten fatter: The average weight of an adult passenger has been officially revised from 160 pounds to 185 pounds. (That’s from 11 stone 6 to 13 stone 3 in the UK,
The shell team often gets questions like these from customers:
Attached please find a sample program which continuously
writes data to a file.
If you open the folder containing the file in Explorer, you can see
that the file size is reported as zero.
A customer was having trouble obtaining information from
a shortcut file.
“Here is a sample program that tries to print the target
of a shortcut file, but it only gets the file name without
How do I get the full path?”
Given an LCID, how does one determine whether the language lays out left-to-right or right-to-left? One suggestion was simply to hard-code the list of known right-to-left languages, and if the language isn’t on the list, then assume that it is left-to-right.
One of the continuing compatibility problems that plagued Direct3D was the way it reported texture formats. Historically, the way an application checked which texture formats were available was by calling EnumZBufferFormats and passing a callback function which is called once for each supported format.