<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView]]></title><description><![CDATA[<p>Hey @all,</p>
<p>ich habe schon die Beispiele von <a href="http://codeguru.com" rel="nofollow">codeguru.com</a> und <a href="http://codeproject.com" rel="nofollow">codeproject.com</a> probiert, aber das Mit dem Drag &amp; Drop funktioniert einfach nicht.</p>
<p>Kann mir da bitte jemand helfen? Bin schon am verzweifeln <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/182388/bitte-um-hilfe-beim-drag-amp-drop-in-einer-treeview</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 11:45:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/182388.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 May 2007 14:44:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Thu, 24 May 2007 14:44:54 GMT]]></title><description><![CDATA[<p>Hey @all,</p>
<p>ich habe schon die Beispiele von <a href="http://codeguru.com" rel="nofollow">codeguru.com</a> und <a href="http://codeproject.com" rel="nofollow">codeproject.com</a> probiert, aber das Mit dem Drag &amp; Drop funktioniert einfach nicht.</p>
<p>Kann mir da bitte jemand helfen? Bin schon am verzweifeln <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1291463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1291463</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Thu, 24 May 2007 14:44:54 GMT</pubDate></item><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Thu, 24 May 2007 15:47:06 GMT]]></title><description><![CDATA[<p>Lol und wie soll man dir helfen? Was funktioniert nicht? Poste mal bitte (den relevanten) Code!<br />
Soll dir jetzt hier jemand noch ein Beispiel (was letztendlich das gleiche sein wird :)) posten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>schirrmie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1291514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1291514</guid><dc:creator><![CDATA[schirrmie]]></dc:creator><pubDate>Thu, 24 May 2007 15:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Thu, 24 May 2007 16:06:10 GMT]]></title><description><![CDATA[<p>Hier die Hauptfunktionen:</p>
<pre><code>bool g_fDragging;
HIMAGELIST himl;
void Main_OnBeginDrag(HWND hwndTV, LPNMTREEVIEW lpnmtv) {
        // handle to image list
    RECT rcItem;        // bounding rectangle of item
    DWORD dwLevel;      // heading level of item
    DWORD dwIndent;     // amount that child items are indented

    // Tell the tree view control to create an image to use
    // for dragging.
    himl = TreeView_CreateDragImage(hwndTV, lpnmtv-&gt;itemNew.hItem);

    // Get the bounding rectangle of the item being dragged.
    TreeView_GetItemRect(hwndTV, lpnmtv-&gt;itemNew.hItem, &amp;rcItem, TRUE);

    // Get the heading level and the amount that the child items are
    // indented.
    dwLevel = lpnmtv-&gt;itemNew.lParam;
    dwIndent = (DWORD) SendMessage(hwndTV, TVM_GETINDENT, 0, 0);

    // Start the drag operation.
    ImageList_BeginDrag(himl, 0, -5, -5);

    // Hide the mouse cursor, and direct mouse input to the
    // parent window.
    ShowCursor(FALSE);
    SetCapture(GetParent(hwndTV));
    g_fDragging = true;
    return;
} 

void Main_OnMouseMove(HWND hwndParent, HWND hwndTV, LONG xCur, LONG yCur)
{
    HTREEITEM htiTarget;  // handle to target item
    TVHITTESTINFO tvht;  // hit test information

    if( g_fDragging ) {

        // Drag the item to the current position of the mouse cursor.
        ImageList_DragMove(xCur, yCur);

        // Find out if the cursor is on the item. If it is, highlight
        // the item as a drop target.
        tvht.pt.x = xCur;
        tvht.pt.y = yCur;
        if( (htiTarget = TreeView_HitTest(hwndTV, &amp;tvht)) != NULL ) {
            TreeView_SelectDropTarget(hwndTV, htiTarget);
        }
    }
    return;
}
</code></pre>
<p>Und hier die Notifications:</p>
<pre><code>case WM_NOTIFY: {
		switch(LOWORD(wParam)) {
			case IDC_TREE2: {
				LPNMTREEVIEW pnm = (LPNMTREEVIEW)lParam;
				switch (((LPNMHDR) lParam)-&gt;code) {
					case TVN_BEGINDRAG: {
						Main_OnBeginDrag(hTree2, (LPNMTREEVIEW)lParam);
					}
					break; 
				}
			}
		}
}
.
.
.
case WM_MOUSEMOVE: {
	if( g_fDragging == true )
		Main_OnMouseMove(hDlg, hTree2, LOWORD(lParam), HIWORD(lParam));
} 
break;
case WM_LBUTTONUP: {
	if( g_fDragging ) {
		ImageList_EndDrag();
		ReleaseCapture();
		ShowCursor(TRUE);
		g_fDragging = false;
	}
}
break;
</code></pre>
<p>Ich will einfach nur elemente mittels drag and drop in der position verschieben können und eventuell in eine 2te treeview ziehen können</p>
<p>Vielen Dank</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1291525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1291525</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Thu, 24 May 2007 16:06:10 GMT</pubDate></item><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Thu, 24 May 2007 16:08:15 GMT]]></title><description><![CDATA[<p>Ja ich habs jetzt nur überflogen und so ähnlich sieht meins auch aus (liegt wahrscheinlich daran das ich das selbe Beispiel genutzt habe) und es funktioniert bei mir. Was funktioniert jetzt nicht?</p>
<p>schirrmie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1291527</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1291527</guid><dc:creator><![CDATA[schirrmie]]></dc:creator><pubDate>Thu, 24 May 2007 16:08:15 GMT</pubDate></item><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Thu, 24 May 2007 16:48:21 GMT]]></title><description><![CDATA[<p>1.) Ich kann keine treeitem elemente bewegen (kopieren/verschieben)<br />
2.) Er Zeigt kein DragBild an<br />
3.) Zeigt nicht das Ziel an wohin es kopiert/verschoben werden soll.</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1291563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1291563</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Thu, 24 May 2007 16:48:21 GMT</pubDate></item><item><title><![CDATA[Reply to Bitte um Hilfe beim Drag &amp;amp; Drop in einer TreeView on Tue, 29 May 2007 16:52:18 GMT]]></title><description><![CDATA[<p>OK, scheint nun im selben Treeview zu funktionieren, jedoch wie ziehe ich Nodes von einer Treeview in die andere?</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1294663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1294663</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Tue, 29 May 2007 16:52:18 GMT</pubDate></item></channel></rss>