<?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[Maus Click auf ListView simulieren]]></title><description><![CDATA[<p>Hi,</p>
<p>ich lese aus einem anderen Programm den Listview aus und möchte auf eine bestimmte Zeile einen Doppelklick simulieren.<br />
Hier mal de betreffende code:</p>
<pre><code class="language-cpp">// listview = handle auf ein listview

 int count=(int)SendMessage(listview, LVM_GETITEMCOUNT, 0, 0);
 int i;
 LVITEM lvi, *_lvi;
 char item[512];
 char *_item, *_subitem;
 unsigned long pid;
 HANDLE process;

 GetWindowThreadProcessId(listview, &amp;pid);
 process=O
penProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|
                     PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);

 _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM),
                              MEM_COMMIT, PAGE_READWRITE);
 _item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,
                             PAGE_READWRITE);
 _subitem=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,
                                PAGE_READWRITE);

 lvi.cchTextMax=512;

 char table[]=&quot;Diese TabellenZeile suche ich&quot;;

for(i=0; i&lt;count; i++) {
  lvi.iSubItem=0;
  lvi.pszText=_item;
  lvi.mask = LVIF_TEXT;

  WriteProcessMemory(process, _lvi, &amp;lvi, sizeof(LVITEM), NULL);
  SendMessage(listview, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);
  ReadProcessMemory(process, _item, item, 512, NULL);

  if( strncmp(item, table, strlen(table)) == 0 ){
	lvi.state=LVIS_SELECTED;
	lvi.stateMask=LVIS_SELECTED;
	WriteProcessMemory(process, _lvi, &amp;lvi, sizeof(LVITEM), NULL);
	SendMessage(listview,LVM_SETITEMSTATE ,(WPARAM)i,(LPARAM)_lvi);

        // ab hier ist nun die entsprechende Zeile selected, nun möchte ich 
        // einen doppelklick simulieren

       //SendMessage(DOPPELKLICK^^);

  }
</code></pre>
<p>Habe schon etliches probiert.. z.B.:</p>
<pre><code class="language-cpp">WPARAM wParam = MAKEWPARAM (3565, BN_DOUBLECLICKED);
SendMessage(listview, WM_COMMAND, wParam, 0);
</code></pre>
<p>Er selektiert immer die gewünschte Zeile aber es klappt einfach nicht mit dem Doppellklick bzw klick ..<br />
jemand ne Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189226/maus-click-auf-listview-simulieren</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 16:32:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189226.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Aug 2007 22:53:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Maus Click auf ListView simulieren on Thu, 09 Aug 2007 22:53:06 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich lese aus einem anderen Programm den Listview aus und möchte auf eine bestimmte Zeile einen Doppelklick simulieren.<br />
Hier mal de betreffende code:</p>
<pre><code class="language-cpp">// listview = handle auf ein listview

 int count=(int)SendMessage(listview, LVM_GETITEMCOUNT, 0, 0);
 int i;
 LVITEM lvi, *_lvi;
 char item[512];
 char *_item, *_subitem;
 unsigned long pid;
 HANDLE process;

 GetWindowThreadProcessId(listview, &amp;pid);
 process=O
penProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|
                     PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);

 _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM),
                              MEM_COMMIT, PAGE_READWRITE);
 _item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,
                             PAGE_READWRITE);
 _subitem=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,
                                PAGE_READWRITE);

 lvi.cchTextMax=512;

 char table[]=&quot;Diese TabellenZeile suche ich&quot;;

for(i=0; i&lt;count; i++) {
  lvi.iSubItem=0;
  lvi.pszText=_item;
  lvi.mask = LVIF_TEXT;

  WriteProcessMemory(process, _lvi, &amp;lvi, sizeof(LVITEM), NULL);
  SendMessage(listview, LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)_lvi);
  ReadProcessMemory(process, _item, item, 512, NULL);

  if( strncmp(item, table, strlen(table)) == 0 ){
	lvi.state=LVIS_SELECTED;
	lvi.stateMask=LVIS_SELECTED;
	WriteProcessMemory(process, _lvi, &amp;lvi, sizeof(LVITEM), NULL);
	SendMessage(listview,LVM_SETITEMSTATE ,(WPARAM)i,(LPARAM)_lvi);

        // ab hier ist nun die entsprechende Zeile selected, nun möchte ich 
        // einen doppelklick simulieren

       //SendMessage(DOPPELKLICK^^);

  }
</code></pre>
<p>Habe schon etliches probiert.. z.B.:</p>
<pre><code class="language-cpp">WPARAM wParam = MAKEWPARAM (3565, BN_DOUBLECLICKED);
SendMessage(listview, WM_COMMAND, wParam, 0);
</code></pre>
<p>Er selektiert immer die gewünschte Zeile aber es klappt einfach nicht mit dem Doppellklick bzw klick ..<br />
jemand ne Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341944</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341944</guid><dc:creator><![CDATA[Lumpeh]]></dc:creator><pubDate>Thu, 09 Aug 2007 22:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to Maus Click auf ListView simulieren on Sun, 19 Aug 2007 09:27:20 GMT]]></title><description><![CDATA[<p>Du musst WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP<br />
ans Fenster senden.</p>
<p>Es kann auch sein das du den Focus setzen musst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347228</guid><dc:creator><![CDATA[AZ]]></dc:creator><pubDate>Sun, 19 Aug 2007 09:27:20 GMT</pubDate></item><item><title><![CDATA[Reply to Maus Click auf ListView simulieren on Sun, 19 Aug 2007 13:12:47 GMT]]></title><description><![CDATA[<p>Guck mal in die FAQ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347384</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 19 Aug 2007 13:12:47 GMT</pubDate></item></channel></rss>