<?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[Zeile in Listview Markieren]]></title><description><![CDATA[<p>Hallo<br />
Ich habe ein Listview erstellt. Nun möchte ich aber gerne, dass wen ich auf einen Eintrag klicke, das dann die ganze Zeile markiert wird. Kann mir jemand sagen wie ich das verwirklichen kann?</p>
<p>Mfg Tim</p>
<pre><code class="language-cpp">bool InsertListViewColumn (HWND hListView, 
                           LPTSTR lpColumnName, 
                           int iWidth, 
                           int iSubItem, 
                           DWORD dwStyle = NULL) 
{ 
    int iStatus; 
    LV_COLUMN lvc; 

    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; 
    lvc.fmt = LVCFMT_LEFT | dwStyle; 
    lvc.cx = iWidth; 
    lvc.pszText = lpColumnName; 
    lvc.cchTextMax = 100; 
    lvc.iSubItem = iSubItem; 

    iStatus = ListView_InsertColumn (hListView, iSubItem, &amp;lvc); 

    return (iStatus != -1); 
}

bool InsertListViewEntry (HWND hListView, 
                          LPTSTR lpEntryValue, 
                          int iRowID, 
                          int iColID) 
{ 
    int iStatus; 
    LV_ITEM lvi; 

    lvi.mask = LVIF_TEXT; 
    lvi.iItem = iRowID; 
    lvi.iSubItem = iColID; 
    lvi.pszText = lpEntryValue; 
    lvi.cchTextMax = MAX_PATH; 

    if (iColID == 0) 
        iStatus = ListView_InsertItem (hListView, &amp;lvi); 
    else 
        iStatus = ListView_SetItem (hListView, &amp;lvi); 

    return (iStatus != -1 || iStatus != false); 
}

...
case WM_CREATE:
		{
			hListView = CreateWindow (WC_LISTVIEW, L&quot;&quot;, 
                              WS_CHILD | WS_VISIBLE | LVS_REPORT, 
                              10, 10, 775, 500,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
	InsertListViewColumn (hListView, L&quot;Genere&quot;, 150, 0); 
	InsertListViewColumn (hListView, L&quot;Bezeichnung&quot;, 150, 1); 
	InsertListViewColumn (hListView, L&quot;Farbe&quot;, 150, 2); 

	InsertListViewEntry (hListView, L&quot;Auto&quot;, 0, 0);
    InsertListViewEntry (hListView, L&quot;A400453&quot;, 0, 1); 
	InsertListViewEntry (hListView, L&quot;ROT&quot;, 0, 2); 
	ListView_SetItemState(hListView,1,LVIS_FOCUSED, LVIS_STATEIMAGEMASK);

			return 0;
		}
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/243748/zeile-in-listview-markieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Apr 2026 04:47:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/243748.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Jun 2009 19:59:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sat, 20 Jun 2009 19:59:07 GMT]]></title><description><![CDATA[<p>Hallo<br />
Ich habe ein Listview erstellt. Nun möchte ich aber gerne, dass wen ich auf einen Eintrag klicke, das dann die ganze Zeile markiert wird. Kann mir jemand sagen wie ich das verwirklichen kann?</p>
<p>Mfg Tim</p>
<pre><code class="language-cpp">bool InsertListViewColumn (HWND hListView, 
                           LPTSTR lpColumnName, 
                           int iWidth, 
                           int iSubItem, 
                           DWORD dwStyle = NULL) 
{ 
    int iStatus; 
    LV_COLUMN lvc; 

    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; 
    lvc.fmt = LVCFMT_LEFT | dwStyle; 
    lvc.cx = iWidth; 
    lvc.pszText = lpColumnName; 
    lvc.cchTextMax = 100; 
    lvc.iSubItem = iSubItem; 

    iStatus = ListView_InsertColumn (hListView, iSubItem, &amp;lvc); 

    return (iStatus != -1); 
}

bool InsertListViewEntry (HWND hListView, 
                          LPTSTR lpEntryValue, 
                          int iRowID, 
                          int iColID) 
{ 
    int iStatus; 
    LV_ITEM lvi; 

    lvi.mask = LVIF_TEXT; 
    lvi.iItem = iRowID; 
    lvi.iSubItem = iColID; 
    lvi.pszText = lpEntryValue; 
    lvi.cchTextMax = MAX_PATH; 

    if (iColID == 0) 
        iStatus = ListView_InsertItem (hListView, &amp;lvi); 
    else 
        iStatus = ListView_SetItem (hListView, &amp;lvi); 

    return (iStatus != -1 || iStatus != false); 
}

...
case WM_CREATE:
		{
			hListView = CreateWindow (WC_LISTVIEW, L&quot;&quot;, 
                              WS_CHILD | WS_VISIBLE | LVS_REPORT, 
                              10, 10, 775, 500,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);
	InsertListViewColumn (hListView, L&quot;Genere&quot;, 150, 0); 
	InsertListViewColumn (hListView, L&quot;Bezeichnung&quot;, 150, 1); 
	InsertListViewColumn (hListView, L&quot;Farbe&quot;, 150, 2); 

	InsertListViewEntry (hListView, L&quot;Auto&quot;, 0, 0);
    InsertListViewEntry (hListView, L&quot;A400453&quot;, 0, 1); 
	InsertListViewEntry (hListView, L&quot;ROT&quot;, 0, 2); 
	ListView_SetItemState(hListView,1,LVIS_FOCUSED, LVIS_STATEIMAGEMASK);

			return 0;
		}
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1730193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730193</guid><dc:creator><![CDATA[Fatal Error appears]]></dc:creator><pubDate>Sat, 20 Jun 2009 19:59:07 GMT</pubDate></item><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sat, 20 Jun 2009 20:20:01 GMT]]></title><description><![CDATA[<p>Probiers mal so</p>
<pre><code class="language-cpp">SendMessage(hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, (WPARAM)0, (LPARAM)LVS_EX_FULLROWSELECT);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1730202</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730202</guid><dc:creator><![CDATA[.......]]></dc:creator><pubDate>Sat, 20 Jun 2009 20:20:01 GMT</pubDate></item><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sat, 20 Jun 2009 20:25:01 GMT]]></title><description><![CDATA[<p>Perfekt. Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1730206</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730206</guid><dc:creator><![CDATA[Fatal Error appears]]></dc:creator><pubDate>Sat, 20 Jun 2009 20:25:01 GMT</pubDate></item><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sun, 21 Jun 2009 11:22:12 GMT]]></title><description><![CDATA[<p>Hab jetzt aber noch eine Frage:<br />
Ich hätte gerne, dass man immer nur eine Zeile markieren kann. Ich habs mit LVS_SINGLESEL probiert aber das bewirkt nur, dass ich vor jede Zeile eine Checkbox bekomme aber immer noch mehrere markieren kann.</p>
<p>Mfg Tim</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1730425</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730425</guid><dc:creator><![CDATA[Fatal Error appears]]></dc:creator><pubDate>Sun, 21 Jun 2009 11:22:12 GMT</pubDate></item><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sun, 21 Jun 2009 14:01:16 GMT]]></title><description><![CDATA[<p>LVS_SINGLESEL ist ein einfacher Fensterstil, Du kannst diesen direkt beim Aufruf der CreateWindow-Funktion festlegen:</p>
<pre><code class="language-cpp">WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SINGLESEL
</code></pre>
<p>Bei der Verwendung von LVM_SETEXTENDEDLISTVIEWSTYLE schlägt es fehl, weil LVS_EX_CHECKBOXES den gleichen Wert hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1730515</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730515</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Sun, 21 Jun 2009 14:01:16 GMT</pubDate></item><item><title><![CDATA[Reply to Zeile in Listview Markieren on Sun, 21 Jun 2009 15:24:41 GMT]]></title><description><![CDATA[<p>Ah ok. Da drauf bin ich nicht gekommen. Wieder was dazugelernt..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1730551</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1730551</guid><dc:creator><![CDATA[Fatal Error appears]]></dc:creator><pubDate>Sun, 21 Jun 2009 15:24:41 GMT</pubDate></item></channel></rss>