Introduction
I've written a DialogClass which supports Drag & Drop.
First I will describe how you can add the Drag&Drop behaviour to an existing
dialog - That's really simple
Copy the DragDialog.h and DragDialog.cpp to your project directory.
For example, the name of my dialog class is CTestDragDlg.
Include DragDialog.h in your StdAfx.h or in the .h and .cpp file of your dialog.
Open the header file of your dialog and search for a line looking like this:
class CTestDragDlg : public CDialog
Change
CDialog
to
CDragDialog
, it should then look like this:
class CTestDragDlg : public CDragDialog
Now open the .cpp file of your dialog and search for a line looking like this:
CTestDragDlg::CTestDragDlg(CWnd* pParent )
: CDialog(CTestDragDlg::IDD, pParent)
{
Simply replace
CDialog
with
CDragDialog
...
Now search the code for something look like this:
BEGIN_MESSAGE_MAP(CTestDragDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
END_MESSAGE_MAP()
Replace
CDialog
with
CDragDialog
.
Now try to compile it!
If you get any errors with a precompiled header, go to the project options and
say that you won't use precompiled headers.
Congratulations, you have now a Drag&Drop Dialog!
The Options
Now you can change the drag behaviour of your DragDialog, here are some examples.
Have a lot of fun with it!
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.