Hi,

I worked on Iczenlions Tutorial #19, Drag&Drop for treeviews. Works fine!
But is it possible to change the code, that it will work with a listview, instead of a treeview?

 ? ?.elseif uMsg==WM_NOTIFY 
? ? ? ?mov edi,lParam
? ? ? ?assume edi:ptr NM_TREEVIEW
? ? ? ?.if .hdr.code==TVN_BEGINDRAG
? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_CREATEDRAGIMAGE,0,.itemNew.hItem
? ? ? ? ? ?mov hDragImageList,eax
? ? ? ? ? ?invoke ImageList_BeginDrag,hDragImageList,0,0,0
? ? ? ? ? ?invoke ImageList_DragEnter,hwndTreeView,.ptDrag.x,.ptDrag.y
? ? ? ? ? ?invoke SetCapture,hWnd
? ? ? ? ? ?mov DragMode,TRUE
? ? ? ?.endif
? ? ? ?assume edi:nothing

? .elseif uMsg==WM_MOUSEMOVE
? ? ? ?.if DragMode==TRUE
? ? ? ? ? ?mov eax,lParam
? ? ? ? ? ?and eax,0ffffh
? ? ? ? ? ?mov ecx,lParam
? ? ? ? ? ?shr ecx,16
? ? ? ? ? ?mov tvhit.pt.x,eax
? ? ? ? ? ?mov tvhit.pt.y,ecx
? ? ? ? ? ?invoke ImageList_DragMove,eax,ecx
? ? ? ? ? ?invoke ImageList_DragShowNolock,FALSE
? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_HITTEST,NULL,addr tvhit
? ? ? ? ? ?.if eax!=NULL
? ? ? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_SELECTITEM,TVGN_DROPHILITE,eax
? ? ? ? ? ?.endif
? ? ? ? ? ?invoke ImageList_DragShowNolock,TRUE
? ? ? ?.endif

? ?.elseif uMsg==WM_LBUTTONUP
? ? ? ?.if DragMode==TRUE
? ? ? ? ? ?invoke ImageList_DragLeave,hwndTreeView
? ? ? ? ? ?invoke ImageList_EndDrag
? ? ? ? ? ?invoke ImageList_Destroy,hDragImageList
? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_GETNEXTITEM,TVGN_DROPHILITE,0
? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_SELECTITEM,TVGN_CARET,eax
? ? ? ? ? ?invoke SendMessage,hwndTreeView,TVM_SELECTITEM,TVGN_DROPHILITE,0
? ? ? ? ? ?invoke ReleaseCapture
? ? ? ? ? ?mov DragMode,FALSE
? ? ? ?.endif


Greetings, Nordwind64
Posted on 2005-04-10 08:26:51 by Nordwind64
Hi,

seems, it is not possible. Is that right?

Best regards,
Nordwind64
Posted on 2005-04-11 23:43:17 by Nordwind64
I assume you want to drag&drop a file in your listview/window
why not something like this

; handle of your window
invoke DragAcceptFiles,hWindow,TRUE?

and in wndproc from example

cmp? ? ?uMsg,WM_DROPFILES
;your coding here to do something usefull
invoke DragQueryFile ......and so on ..





Posted on 2005-04-14 10:59:47 by Allanon
Hi,

dropping in is easy. No, I want to drag&drop out a listview.
But it seems, that's only possible using COM...

Thanks,
Nordwind64
Posted on 2005-04-14 15:05:59 by Nordwind64
ah oki sorry

think it should be possible most messages are kinda the same

just exchange for example

assume edi:ptr NM_TREEVIEW
with
assume edi:ptr NM_LISTVIEW

and
.if .hdr.code==TVN_BEGINDRAG
with
.if .hdr.code==LVN_BEGINDRAG

didn?t tried it but most messages just start with LVN or LVM instead TVM
hint : check msdn for rest of messages ;)

Posted on 2005-04-15 08:10:12 by Allanon