<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=DetailUpdate</id>
	<title>DetailUpdate - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=DetailUpdate"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DetailUpdate&amp;action=history"/>
	<updated>2026-05-12T20:14:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=DetailUpdate&amp;diff=18557&amp;oldid=prev</id>
		<title>Afrow UK: Created page with &#039;{{PageAuthor|Afrow UK}}  == Description == A small function/macro combo to update the text of the last item printed in the install files page list view control. It also updates t…&#039;</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DetailUpdate&amp;diff=18557&amp;oldid=prev"/>
		<updated>2010-05-27T12:02:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;{{PageAuthor|Afrow UK}}  == Description == A small function/macro combo to update the text of the last item printed in the install files page list view control. It also updates t…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageAuthor|Afrow UK}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
A small function/macro combo to update the text of the last item printed in the install files page list view control. It also updates the status label above the progress bar with the same text.&lt;br /&gt;
&lt;br /&gt;
== The Function ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function DetailUpdate&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
  Push $R3&lt;br /&gt;
&lt;br /&gt;
  FindWindow $R2 `#32770` `` $HWNDPARENT&lt;br /&gt;
  GetDlgItem $R1 $R2 1006&lt;br /&gt;
  SendMessage $R1 ${WM_SETTEXT} 0 `STR:$R0`&lt;br /&gt;
  GetDlgItem $R1 $R2 1016&lt;br /&gt;
&lt;br /&gt;
  System::Call *(&amp;amp;t${NSIS_MAX_STRLEN}R0)i.R2&lt;br /&gt;
  System::Call *(i0,i0,i0,i0,i0,iR2,i${NSIS_MAX_STRLEN},i0,i0)i.R3&lt;br /&gt;
&lt;br /&gt;
  !define LVM_GETITEMCOUNT 0x1004&lt;br /&gt;
  !define LVM_SETITEMTEXT 0x102E&lt;br /&gt;
  SendMessage $R1 ${LVM_GETITEMCOUNT} 0 0 $R0&lt;br /&gt;
  IntOp $R0 $R0 - 1&lt;br /&gt;
  System::Call user32::SendMessage(iR1,i${LVM_SETITEMTEXT},iR0,iR3)&lt;br /&gt;
&lt;br /&gt;
  System::Free $R3&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
&lt;br /&gt;
  Pop $R3&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
!macro DetailUpdate Text&lt;br /&gt;
  Push `${Text}`&lt;br /&gt;
  Call DetailUpdate&lt;br /&gt;
!macroend&lt;br /&gt;
!define DetailUpdate `!insertmacro DetailUpdate`&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
I&amp;#039;ve decided to use the System plug-in to call SendMessage for setting the list view item text. This probably isn&amp;#039;t necessary (the built in SendMessage did work as well) but as System has allocated the memory I&amp;#039;d rather be on the safe side and use that instead.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function SomeProcess&lt;br /&gt;
  DetailPrint `Processing: 0% done...`&lt;br /&gt;
  ${For} $R0 1 5&lt;br /&gt;
    Sleep 2000&lt;br /&gt;
    IntOp $R1 $R0 * 20&lt;br /&gt;
    ${DetailUpdate} `Processing: $R1% done...`&lt;br /&gt;
  ${Next}&lt;br /&gt;
  ${DetailUpdate} `Processing complete!`&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section `Some process`&lt;br /&gt;
  Call SomeProcess&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Note that I&amp;#039;ve placed the loop inside a function and called that function from the section otherwise the progress bar will move back and forth.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
The install files page window is just a standard Windows SysListView32 control which means you can send any of the LVM_* messages to it. Some messages however such as [http://msdn.microsoft.com/en-us/library/bb761198%28VS.85%29.aspx LVM_SETITEMTEXT] require a [http://msdn.microsoft.com/en-us/library/bb774760%28VS.85%29.aspx LVITEM] struct as well as a buffer containing the text to set. The first System::Call allocates that buffer and initialises it with the new text and the second System::Call allocates the LVITEM struct containing a pointer to that buffer. At the end we have to free these two chunks of allocated memory using System::Free. Using this code it should be straight forward to work with other list view controls such as with nsDialogs.&lt;br /&gt;
&lt;br /&gt;
[[Category:Functions_&amp;amp;_Macros]]&lt;/div&gt;</summary>
		<author><name>Afrow UK</name></author>
	</entry>
</feed>