Using the MNS_DRAGDROP style: Dragging out (The Old New Thing)

Windows 2000 introduced the `MNS_DRAG­DROP` 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_DRAG­DROP` menu style until I started
writing this entry. But I simply read the documentation, which says that if
you set this style, you will receive `WM_MENU­DRAG` and `WM_MENU­GET­OBJECT`
messages. The `WM_MENU­DRAG` message is sent when the user drags a menu item,
so let’s go with that first. The documentation says that you get information
about the item that was dragged, and then you return a code that specifies
whether you want the menu to remain up or whether you want it torn down.

Simple enough. Let’s do it.

Start with the scratch program, add the function `Get­UI­Object­Of­File` and
the class `CDrop­Source`, and change the calls to `Co­Initialize` and
`Co­Uninitialize` into `Ole­Initialize` and `Ole­Uninitialize`, respectively.
Next, define the menu we’re going to play with:

// resource header file

#define IDM_MAIN 1

#define IDC_CLOCK 100

// resource file

IDM_MAIN …

The Old New Thing

eBay Logo  

MBRP Cat-Back Exhaust 07-08 Tundra 4.7L DC-Std. & CM-SB Turn Down Single Side T4


MBRP Cat-Back Exhaust 07-08 Tundra 4.7L DC-Std. & CM-SB Turn Down Single Side T4


$439.99


MBRP Toyota Tundra 4.7L DC-Std CM-SB 2009 Cat Back, Turn Down Single Side, T409


MBRP Toyota Tundra 4.7L DC-Std CM-SB 2009 Cat Back, Turn Down Single Side, T409


$439.99


American Std 4332.300.075 Pull-Down Spray Stainless


American Std 4332.300.075 Pull-Down Spray Stainless


$356.42


MBRP Toyota Tundra 4.7, DC-Std. CM-SB 2009 Cat Back, Turn Down Single Side, AL


MBRP Toyota Tundra 4.7, DC-Std. CM-SB 2009 Cat Back, Turn Down Single Side, AL


$309.99


Pacific Coast Double Down Surround 4-Std Pillows Feat in Waldorf Astoria


Pacific Coast Double Down Surround 4-Std Pillows Feat in Waldorf Astoria


$199.99


Pillowtex ® Down & Feather Luxury Hotel 4-Std Pillow Set


Pillowtex ® Down & Feather Luxury Hotel 4-Std Pillow Set


$189.99


BedRug VanRug Cargo Mat VRF92 1992-2012 Ford E-Series Van Std Full/Down


BedRug VanRug Cargo Mat VRF92 1992-2012 Ford E-Series Van Std Full/Down


$170.05


BedRug VanRug Cargo Mat VRG96 1996-12 Chevrolet Express/Savana Std Full/Down


BedRug VanRug Cargo Mat VRG96 1996-12 Chevrolet Express/Savana Std Full/Down


$170.05


PARISIAN Pair Std European White Goose Down Bed Pillow


PARISIAN Pair Std European White Goose Down Bed Pillow


$159.99


Phoenix Down 50/50 Feather/Polyester Std 4-Pillow Set


Phoenix Down 50/50 Feather/Polyester Std 4-Pillow Set


$144.99


NAPOLI Pair Std European White Goose Down Bed Pillow


NAPOLI Pair Std European White Goose Down Bed Pillow


$144.99


Pacific Coast Double Down Surround 2-Std Pillows Feat in Waldorf Astoria


Pacific Coast Double Down Surround 2-Std Pillows Feat in Waldorf Astoria


$109.99


Intro-Tech


Intro-Tech “Hexomat” All Weather Mats for – Ford Expedition 2007-11 Cargo


$99.95


Intro-Tech


Intro-Tech “Hexomat” All Weather Mats for – Ford Expedition 2007-11 Cargo


$99.95


Intro-Tech


Intro-Tech “Hexomat” All Weather Mats for – Ford Expedition 2007-11 Cargo


$99.95


Intro-Tech


Intro-Tech “Hexomat” All Weather Mats for – Ford Expedition 2007-11 Cargo


$99.95


Intro-Tech


Intro-Tech “Hexomat” All Weather Mats for – Ford Expedition 2007-11 Cargo


$99.95


RETRACTABLE TRANSOM RATCHET TIE-DOWNS, STD 2


RETRACTABLE TRANSOM RATCHET TIE-DOWNS, STD 2″ X 43″ PART# 2060266(F)


$80.00


Pacific Coast ® Down Surround 2-Std Pillows Feat in Waldorf Astoria


Pacific Coast ® Down Surround 2-Std Pillows Feat in Waldorf Astoria


$84.99


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


$79.95


Phoenix Down 50/50 Feather/Polyester Std 2-Pillow Set


Phoenix Down 50/50 Feather/Polyester Std 2-Pillow Set


$74.99


LPHC Triple Chamber Down and Feather Pillow Std/Queen


LPHC Triple Chamber Down and Feather Pillow Std/Queen


$69.95


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


$69.95


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


Sealy Posturepedic Double Down Surround Pillows in all sizes Std., Queen , King


$59.95


Deluxe Down Pillow in Zippered Bag w/ Insert Std/Queen


Deluxe Down Pillow in Zippered Bag w/ Insert Std/Queen


$44.95


Comforel ® Std Down Alt Pillow - Feat in Best Western ®


Comforel ® Std Down Alt Pillow – Feat in Best Western ®


$39.99


STD/QUEEN FEATHER GOOSE DOWN BED PILLOW SET 2 PILLOWS


STD/QUEEN FEATHER GOOSE DOWN BED PILLOW SET 2 PILLOWS


$38.99


Std/Q 20


Std/Q 20″ X 26″ Feather Down Mix Pillow by Southern Tex


$28.55


Pyramid Style Lay-Down  Lic Plate Frame, 55-96 Harley W/ std Hole Pattern,Custom


Pyramid Style Lay-Down Lic Plate Frame, 55-96 Harley W/ std Hole Pattern,Custom


$18.36


N8284N, IC,COUNTER,UP/DOWN,4-BIT BINARY,STD-TTL, 14 Pin


N8284N, IC,COUNTER,UP/DOWN,4-BIT BINARY,STD-TTL, 14 Pin


$20.00


N8284N, IC,COUNTER,UP/DOWN,4-BIT BINARY,STD-TTL, 14 Pin


N8284N, IC,COUNTER,UP/DOWN,4-BIT BINARY,STD-TTL, 14 Pin


$20.00


PARTS UNLIMITED TIE DOWN 1.5


PARTS UNLIMITED TIE DOWN 1.5″STD BLUE PR


$22.95


Kwik Tek STD-6C Suction Cup Tie Downs 4 Pack (6-Inches)


Kwik Tek STD-6C Suction Cup Tie Downs 4 Pack (6-Inches)


$22.38


Traxxas Std Battery Hold Downs (2):EMX,


Traxxas Std Battery Hold Downs (2):EMX,


$6.00


100 Fly Tying Hooks CHS2302 #10  Down eye 2XL Std Wire


100 Fly Tying Hooks CHS2302 #10 Down eye 2XL Std Wire


$5.69


Traxxas 3927 Std Battery Hold Downs (2): 1/10 E-Maxx New


Traxxas 3927 Std Battery Hold Downs (2): 1/10 E-Maxx New


$4.52


Traxxas Std Battery Hold Downs (2):EMX TRA3927


Traxxas Std Battery Hold Downs (2):EMX TRA3927


$4.99


Traxxas Std Battery Hold Downs (2):EMX TRA3927


Traxxas Std Battery Hold Downs (2):EMX TRA3927


$4.26


100 Fly Tying Hooks CHS2302 #10  Down eye 2XL Std Wire


100 Fly Tying Hooks CHS2302 #10 Down eye 2XL Std Wire


$4.69


SEAT COVERS BUCKETS F&R CAMARO 67 68 STD FOLD DOWN SEAT


SEAT COVERS BUCKETS F&R CAMARO 67 68 STD FOLD DOWN SEAT


$219.93


82-89 90 91 92 93 94 S10 PICKUP WHEEL 14X6 STD STEEL -  SCROLL DOWN TO RED FOR B


82-89 90 91 92 93 94 S10 PICKUP WHEEL 14X6 STD STEEL – SCROLL DOWN TO RED FOR B


$35.00


82-89 90 91 92 93 94 S10 PICKUP WHEEL 14X6 STD STEEL -  SCROLL DOWN TO RED FOR B


82-89 90 91 92 93 94 S10 PICKUP WHEEL 14X6 STD STEEL – SCROLL DOWN TO RED FOR B


$35.00


89 CAD-STD-F LID MOTOR PULL DOWN


89 CAD-STD-F LID MOTOR PULL DOWN


$35.00


ALLSTAR PERFORMANCE 27502 DIST HOLD DOWN STD BLUE


ALLSTAR PERFORMANCE 27502 DIST HOLD DOWN STD BLUE


$28.99


ALLSTAR PERFORMANCE 27503 DIST HOLD DOWN STD CLEAR


ALLSTAR PERFORMANCE 27503 DIST HOLD DOWN STD CLEAR


$28.99


ALLSTAR PERFORMANCE 27504 DIST HOLD DOWN STD RED


ALLSTAR PERFORMANCE 27504 DIST HOLD DOWN STD RED


$28.99


 Galco Tie Down set  Holster & Ammo Side / STD / MCTD


Galco Tie Down set Holster & Ammo Side / STD / MCTD


$22.95


Kwik Tek Suction Cup Tie Downs STD-6C - 4 Pack


Kwik Tek Suction Cup Tie Downs STD-6C – 4 Pack


$10.95