Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WTL for MFC Programmers, Part X - Implementing a Drag and Drop Source

, 16 Jun 2006
A tutorial on using drag and drop in your WTL application.
wtl4mfc10_demo.zip
WTL4MFC10_demo
WTLCabView
release
WTLCabView.exe
res
next.ico
prev.ico
Toolbar.bmp
WTLCabView.exe.manifest
WTLCabView.ico
WTLCabView.dsp
WTLCabView.dsw
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "atlres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""atlres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ""res\\\\WTLCabView.exe.manifest""\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//

IDR_MAINFRAME TOOLBAR DISCARDABLE  16, 16
BEGIN
    BUTTON      ID_FILE_OPEN
    SEPARATOR
    BUTTON      IDC_VIEW_ICONS
    BUTTON      IDC_VIEW_SMALL_ICONS
    BUTTON      IDC_VIEW_LIST
    BUTTON      IDC_VIEW_DETAILS
    BUTTON      IDC_VIEW_TILES
    SEPARATOR
    BUTTON      ID_APP_ABOUT
END


/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDR_MAINFRAME           BITMAP  MOVEABLE PURE   "res\\Toolbar.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDR_MAINFRAME MENU PRELOAD DISCARDABLE 
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
        MENUITEM SEPARATOR
        MENUITEM "(MRU list is empty)",         ID_FILE_MRU_FIRST
        MENUITEM SEPARATOR
        MENUITEM "E&xit",                       ID_APP_EXIT
    END
    POPUP "&View"
    BEGIN
        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
        MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR
        MENUITEM SEPARATOR
        MENUITEM "I&cons",                      IDC_VIEW_ICONS
        MENUITEM "S&mall Icons",                IDC_VIEW_SMALL_ICONS
        MENUITEM "&List",                       IDC_VIEW_LIST
        MENUITEM "&Details",                    IDC_VIEW_DETAILS
        MENUITEM "Til&es",                      IDC_VIEW_TILES
    END
    POPUP "&Help"
    BEGIN
        MENUITEM "&About WTL CAB Viewer",       ID_APP_ABOUT
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON    DISCARDABLE     "res\\WTLCabView.ico"
IDI_PREV_CAB            ICON    DISCARDABLE     "res\\prev.ico"
IDI_NEXT_CAB            ICON    DISCARDABLE     "res\\next.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX DISCARDABLE  0, 0, 276, 71
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,219,50,50,14
    ICON            IDR_MAINFRAME,IDC_STATIC,7,7,21,20
    LTEXT           "WTL CAB Viewer version 1.0\nWritten by Michael Dunn <acidhelm@gmail.com>\nMore info at http://www.codeproject.com/wtl/wtl4mfc10.asp",
                    IDC_STATIC,33,7,236,32
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_ABOUTBOX, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 269
        TOPMARGIN, 7
        BOTTOMMARGIN, 64
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//

IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE 
BEGIN
    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
    "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL
    "P",            ID_FILE_PRINT,          VIRTKEY, CONTROL
    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
END


#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "\0"
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "WTL CAB file viewer\0"
            VALUE "FileVersion", "1.0.0.0\0"
            VALUE "InternalName", "WTLCabView\0"
            VALUE "LegalCopyright", "Released to the public domain\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "WTLCabView.exe\0"
            VALUE "PrivateBuild", "\0"
            VALUE "ProductName", "WTL CAB file viewer\0"
            VALUE "ProductVersion", "1.0.0.0\0"
            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // !_MAC


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE PRELOAD DISCARDABLE 
BEGIN
    IDR_MAINFRAME           "WTL CAB Viewer"
    IDS_MSGBOX_TITLE        "WTL CAB Viewer"
    IDS_OPENFILE_FILTER     "CAB Files (*.cab)|*.cab|All Files (*.*)|*.*|"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ID_FILE_OPEN            "Open a CAB file\nOpen"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ID_APP_ABOUT            "Display program information, version number, and copyright\nAbout"
    ID_APP_EXIT             "Quit the application\nExit"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ID_VIEW_TOOLBAR         "Show or hide the toolbar\nToggle Toolbar"
    ID_VIEW_STATUS_BAR      "Show or hide the status bar\nToggle Status Bar"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ATL_IDS_SCSIZE          "Change the window size"
    ATL_IDS_SCMOVE          "Change the window position"
    ATL_IDS_SCMINIMIZE      "Reduce the window to an icon"
    ATL_IDS_SCMAXIMIZE      "Enlarge the window to full size"
    ATL_IDS_SCCLOSE         "Quit the application"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ATL_IDS_SCRESTORE       "Restore the window to normal size"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ATL_IDS_IDLEMESSAGE     "Ready"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ATL_IDS_MRU_FILE        "Open this CAB file"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDC_VIEW_ICONS          "Change to icon view\nIcon View"
    IDC_VIEW_SMALL_ICONS    "Change to small icon view\nSmall Icon View"
    IDC_VIEW_LIST           "Change to list view\nList View"
    IDC_VIEW_DETAILS        "Change to details view\nDetails View"
    IDC_VIEW_TILES          "Change to tile view\nTile View"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_FDICREATE_FAILED    "FDICreate failed - can't init CAB engine. (Error %d)"
    IDS_FILE_NOT_FOUND      "The specified file was not found."
    IDS_OPEN_CAB_ERROR      "Error opening the specified CAB file for reading."
    IDS_INVALID_CAB_ERROR   "The specified file is not a valid CAB file."
    IDS_FDICOPY_FAILED      "FDICopy failed - can't read contents of the CAB file. (Error %d)"
    IDS_COLHDR_NAME         "Name"
    IDS_COLHDR_TYPE         "Type"
    IDS_COLHDR_SIZE         "Uncompressed Size"
    IDS_COLHDR_DATE         "Date"
    IDS_COLHDR_ATTRS        "Attributes"
    IDS_COLHDR_SPLIT        "Split File"
    IDS_FROM_PREV_CAB       "Continued from %s"
    IDS_TO_NEXT_CAB         "Continued in %s"
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\WTLCabView.exe.manifest"

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Michael Dunn
Software Developer (Senior) VMware
United States United States
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.
 
Mike was a VC MVP from 2005 to 2009.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411019.1 | Last Updated 16 Jun 2006
Article Copyright 2006 by Michael Dunn
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid