<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Library &#187; Process</title>
	<atom:link href="http://www.ucosoft.com/tag/process/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Thu, 22 Jul 2010 05:17:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to get ClistCtrl item text of another process</title>
		<link>http://www.ucosoft.com/get-clistctrl-item-text-of-another-process.html</link>
		<comments>http://www.ucosoft.com/get-clistctrl-item-text-of-another-process.html#comments</comments>
		<pubDate>Wed, 24 Sep 2008 08:19:30 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[CListCtrl]]></category>
		<category><![CDATA[How-to]]></category>
		<category><![CDATA[Injection]]></category>
		<category><![CDATA[Process]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/2008/09/24/get-clistctrl-item-text-of-another-process.html</guid>
		<description><![CDATA[Question: In some app like WinSpy/Spy++ to make adjustments to list controls. It can correctly set an app&#8217;s list control&#8217;s modes, alignments, sorting, styles, and extended styles. It can also get the widths of the columns and count of items. The problem is that you cannot seem to get the columns&#8217; names or the item [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Question:</strong></p>
<p>In some app like WinSpy/Spy++ to make adjustments to list controls. It can correctly set an app&#8217;s list control&#8217;s modes, alignments,    <br />sorting, styles, and extended styles. It can also get the widths of the columns and count of items. </p>
<p>The problem is that you cannot seem to get the columns&#8217; names or the item text. The app uses code like this, where lc is a pointer to the target app&#8217;s list control: </p>
<p>&#160; lc-&gt;GetColumnWidth();    <br />&#160; lc-&gt;GetItemCount();     <br />&#160; lc-&gt;ModifyStyle();     <br />&#160; lc-&gt;SetExtendedStyle();     <br />&#160; lc-&gt;GetHeaderCtrl()-&gt;GetItemCount(); </p>
<p>That all works fine, but when you try something like this, it doesn&#8217;t work: </p>
<p>&#160; TCHAR colname[256]=_T(&quot;&quot;);    <br />&#160; LVCOLUMN lvcol;     <br />&#160; ZeroMemory(&amp;lvcol, sizeof(lvcol));     <br />&#160; lvcol.mask=LVCF_TEXT;     <br />&#160; lvcol.cchTextMax=sizeof(colname)-1;     <br />&#160; lvcol.pszText=colname;     <br />&#160; lc-&gt;GetColumn(col, &amp;lvcol); </p>
<p>GetColumn may return TRUE or FALSE, but the LVCOLUMN structure remains unchanged. If you tried using that same code in a test app to get the name of a column from that app&#8217;s own list control and it worked. It only seems to fail when use it from a different app.</p>
<p><strong><u>Solution:</u></strong></p>
<p>Well, there is no surprise here; in fact, if there is any surprise, it is that you did not manage to totally crash the target app (I presume that lc is a CListCtrl::FromHandle of an HWND in another process). </p>
<p>Think about this case:</p>
<p>you are passing the address of a data structure in YOUR process as a LPARAM-sized value to some totally different process, where that LPARAM value is completely and utterly meaningless. </p>
<p>David Ching did a remote-sendmessage DLL some time ago.&#160; This essentially does DLL injection of the code so it is running in the target process; you can google for this by looking for SendMessageRemote.</p>
<p><a href="http://www.dcsoft.com/private/sendmessageremote.cpp">http://www.dcsoft.com/private/sendmessageremote.cpp</a></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/clistctrl" title="CListCtrl" rel="tag">CListCtrl</a>, <a href="http://www.ucosoft.com/tag/how-to" title="How-to" rel="tag">How-to</a>, <a href="http://www.ucosoft.com/tag/injection" title="Injection" rel="tag">Injection</a>, <a href="http://www.ucosoft.com/tag/process" title="Process" rel="tag">Process</a>, <a href="http://www.ucosoft.com/tag/win32mfc" title="Win32/MFC" rel="tag">Win32/MFC</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/get-clistctrl-item-text-of-another-process.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

