<?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[ListView Sortier Problem]]></title><description><![CDATA[<p>Hab ein bisschen auf <a href="http://Google.de" rel="nofollow">Google.de</a> und <a href="http://msdn.com" rel="nofollow">msdn.com</a> geguckt und alles moegliche gefunden... Das Problem is ich steig durch keinen Code da.</p>
<p>Hat wer vielleicht einen leicht zu verstehenden Link zu dem Thema ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/157587/listview-sortier-problem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 12:34:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/157587.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 Aug 2006 16:46:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 16:46:34 GMT]]></title><description><![CDATA[<p>Hab ein bisschen auf <a href="http://Google.de" rel="nofollow">Google.de</a> und <a href="http://msdn.com" rel="nofollow">msdn.com</a> geguckt und alles moegliche gefunden... Das Problem is ich steig durch keinen Code da.</p>
<p>Hat wer vielleicht einen leicht zu verstehenden Link zu dem Thema ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125550</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125550</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Sun, 27 Aug 2006 16:46:34 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 17:17:38 GMT]]></title><description><![CDATA[<p>Was isn dein Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125577</guid><dc:creator><![CDATA[oO]]></dc:creator><pubDate>Sun, 27 Aug 2006 17:17:38 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 18:06:25 GMT]]></title><description><![CDATA[<p>Wie sortiere ich ListView's (Report Modus)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125625</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125625</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Sun, 27 Aug 2006 18:06:25 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 18:30:11 GMT]]></title><description><![CDATA[<p>PhoeNix_FasT schrieb:</p>
<blockquote>
<p>Wie sortiere ich ListView's (Report Modus)</p>
</blockquote>
<p>Mit der Nachricht LVM_SORTITEMS:</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>LVM_SORTITEMS</p>
<p>LVM_SORTITEMS<br />
wParam = (WPARAM) (LPARAM) lParamSort;<br />
lParam = (LPARAM) (PFNLVCOMPARE) pfnCompare;</p>
<p>Uses an application-defined comparison function to sort the items of a list view control. The index of each item changes to reflect the new sequence. You can send this message explicitly or by using the ListView_SortItems macro.</p>
<p>Returns TRUE if successful, or FALSE otherwise.<br />
lParamSort<br />
Application-defined value that is passed to the comparison function.<br />
pfnCompare<br />
Address of the application-defined comparison function. The comparison function is called during the sort operation each time the relative order of two list items needs to be compared.<br />
The comparison function has the following form:</p>
<p>int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2,<br />
LPARAM lParamSort);</p>
<p>The lParam1 parameter is the 32-bit value associated with the first item being compared, and the lParam2 parameter is the value associated with the second item. These are the values that were specified in the lParam member of the items' LVITEM structure when they were inserted into the list. The lParamSort parameter is the same value passed to the LVM_SORTITEMS message.</p>
<p>The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1125642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125642</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 27 Aug 2006 18:30:11 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 20:20:57 GMT]]></title><description><![CDATA[<p>Na gut das lass ich dann wohl lieber..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125713</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125713</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Sun, 27 Aug 2006 20:20:57 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 23:03:21 GMT]]></title><description><![CDATA[<p>PhoeNix_FasT schrieb:</p>
<blockquote>
<p>Na gut das lass ich dann wohl lieber..</p>
</blockquote>
<p>Wieso ? So schwer ist das doch nicht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>1. Du Definierst eine Vergleichsfunktion:</p>
<p><strong>Beispiel:</strong></p>
<pre><code class="language-cpp">// Return-Werte:
#define COMP_EQUAL      0 // Beide Items sind gleich (Item1 = Item2)
#define COMP_SMALLER   -1 // Item1 (lParam1) soll vor Item2 (lParam2)
#define COMP_GREATER    1 // Item2 (lParam2) soll vor Item1 (lParam1)

int CALLBACK CompareFunction(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
   if(lParam1 &lt; lParam2)
      return (COMP_SMALLER);
   else if(lParam1 &gt; lParam2)
      return (COMP_GREATER);
   else
      return (COMP_EQUAL);
}
</code></pre>
<p>2. Dann 'startest' du den Vergleich so:<br />
<strong>Beispiel:</strong></p>
<pre><code class="language-cpp">SendMessage(hWndListView, LVM_SORTITEMS, 0, reinterpret_cast&lt;LPARAM&gt;(CompareFunction));
</code></pre>
<p>Jetzt sollte ich vllt noch erwähnen, dass lParam1 bzw. lParam2 die 'Zusatz-Daten' eines Items sind.<br />
In meiner obrigen Beispiel-Vergleichsfunktion gehe ich also davon aus, dass das einfache L-Werte sind,<br />
keine Speicheradressen. Wenn du deinem Item als Zusatz-Datenstruktur ein Zeiger auf eine Struktur<br />
übermittelst, um dann beispielsweise ein Element aus der Struktur zu vergleichen, musst du in der<br />
Vergleichsfunktion (CompareFunction) natürlich entsprechend die Parameter lParam1 und lParam2 casten.<br />
Dann kannst du auf die Strukturen der Items zugreifen und deren Elemente vergleichen. So lassen sich dann<br />
beispielsweise Strings vergleichen o.ä.. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>PS_1: Die #defines sind nur wg. der Übersichtlichkeit. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f4a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--light_bulb"
      title=":bulb:"
      alt="💡"
    /><br />
PS_2: Hab leider keinen fertigen Code, sonst würde ich den posten. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125735</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 27 Aug 2006 23:03:21 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 21:04:05 GMT]]></title><description><![CDATA[<p>hm.. zu 70 % verstanden.</p>
<p>Also ich hab das so gemacht : Wenn ich das Programm starte , zeig der mir alle Dateien und Ordner an und die Dateigroesse.</p>
<p>Das sind dann 2 Items ( LVITEM lvi0 und lvi1 ).</p>
<p>Wie .. gehts jetzt weiter ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125750</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Sun, 27 Aug 2006 21:04:05 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 23:04:51 GMT]]></title><description><![CDATA[<p>Nach welchen Kriterien soll den sortiert werden ?</p>
<p>Und:</p>
<p>Wie hast du die Items hinzugefügt ?<br />
Sprich: Wie (und überhaupt?!) hast du die lParam's der Items bestückt ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1125821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125821</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 27 Aug 2006 23:04:51 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Sun, 27 Aug 2006 23:18:45 GMT]]></title><description><![CDATA[<p>Ich hab das jedesmal so gemacht :</p>
<pre><code class="language-cpp">lvi0.iItem = 0;
lvi0.mask = LVIF_TEXT;
lvi0.iSubItem = 0;

ListView_InsertItem(GetDlgItem(phDlg[3],IDC_LIST),&amp;lvi0);
</code></pre>
<p>Und mit ListView_SetItemText() mehr eingefuegt .. funktioniert auch.. was meinst du mit lParam ? <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1125824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125824</guid><dc:creator><![CDATA[PhoeNix_FasT]]></dc:creator><pubDate>Sun, 27 Aug 2006 23:18:45 GMT</pubDate></item><item><title><![CDATA[Reply to ListView Sortier Problem on Mon, 28 Aug 2006 12:52:55 GMT]]></title><description><![CDATA[<p>PhoeNix_FasT schrieb:</p>
<blockquote>
<p>[...]was meinst du mit lParam ? <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>
</blockquote>
<p>U look'in here;</p>
<pre><code class="language-cpp">typedef struct _LVITEM { 
    UINT mask; 
    int iItem; 
    int iSubItem; 
    UINT state; 
    UINT stateMask; 
    LPTSTR pszText; 
    int cchTextMax; 
    int iImage; 
    LPARAM lParam; // /!\ This!
#if (_WIN32_IE &gt;= 0x0300)
    int iIndent;
#endif
#if (_WIN32_WINNT &gt;= 0x560)
    int iGroupId;
    UINT cColumns; // tile view columns
    PUINT puColumns;
#endif
#if (_WIN32_WINNT &gt;= 0x0600)
    int* piColFmt
    int iGroup
#endif
} LVITEM, *LPLVITEM;
</code></pre>
<p>MSDN schrieb:</p>
<blockquote>
<p>[...]</p>
<p>lParam<br />
Value specific to the item. If you use the LVM_SORTITEMS message,<br />
the list-view control passes this value to the application-defined<br />
comparison function. You can also use the LVM_FINDITEM message to search<br />
a list-view control for an item with a specified lParam value.</p>
<p>[...]</p>
</blockquote>
<p>Siehe <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/ListView/Macros/ListView_SetCheckState.asp" rel="nofollow">&lt;hier&gt;</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1126127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1126127</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Mon, 28 Aug 2006 12:52:55 GMT</pubDate></item></channel></rss>