views:

1264

answers:

5

I have a pure Winapi application that needs a few new features. One of them would best be implemented as two lists where you can drag-and-drop (multiple) elements between the lists. The new feature can be limited to a single dialog.

What would be the quickest way to implement this? A few ideas:

  • Pure Winapi (is it DetectDrag)
  • A separate MFC or .NET DLL that provides this one dialog
  • Embed the Microsoft WebBrowser Control and use JQuery

Any of these options that should be avoided?
Any better ideas?
What is quickest to implement?
Any pointers on how to get started?

A: 

Whichever method you are most familiar with is going to be the quickest.

Certainly it is very easy to do this in .NET Windows Forms. You can easily drag and drop items between ListBox entries by writing just a few lines of code. Look at somewhere like CodeProject for samples.

Phil Wright
+5  A: 

My advice would be that if the application is in pure winapi, keep it that way.

Starting a .NET framework runtime just for one dialog with draggable items is as bad as hosting a WebBrowser control and using JQuery for that one functionality - it's at least thedailywtf.com-worthy if you ask me (but then again, you're not asking me ;) ).

Otherwise you will put yourself (and potentially others) into some maintainability nightmare and the quickest way will become the most problematic one.

Edit: Maybe those two articles will help in implementing drag-drop - they're about row reordering in ListViews, but will probably help in getting the idea.

macbirdie
+4  A: 

Raymond Chen wrote a series of blogposts on this topic not too long ago. Start here.

Ben Straub
A: 

All the code is in MSDN in C and win32 api Just copy-paste.

And see professional Win32 api ng news://194.177.96.26/comp.os.ms-windows.programmer.win32 where all this has been discussed for decades...

A: 

A few notes after implementing this in Win32 api:

Drag and drop is not supported by the ListBox control. It has to be a ListView control.

This CodeProject article is very good. (Thanks macbirdie)
The MSDN section of ListViews is of course very useful.

Peter Olsson