<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=550771955</id>
	<title>NSIS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=550771955"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/Special:Contributions/550771955"/>
	<updated>2026-04-21T22:40:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23981</id>
		<title>Recursively remove empty parent directories</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23981"/>
		<updated>2013-12-05T01:17:02Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Another function (by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|ParallaxTZ}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This function and example function call can be used to recursively delete empty parent folders of a given folder. &lt;br /&gt;
&lt;br /&gt;
(Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com))&lt;br /&gt;
&lt;br /&gt;
== The Script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function un.RMDirUP&lt;br /&gt;
         !define RMDirUP &#039;!insertmacro RMDirUPCall&#039;&lt;br /&gt;
&lt;br /&gt;
         !macro RMDirUPCall _PATH&lt;br /&gt;
                push &#039;${_PATH}&#039;&lt;br /&gt;
                Call un.RMDirUP&lt;br /&gt;
         !macroend&lt;br /&gt;
&lt;br /&gt;
         ; $0 - current folder&lt;br /&gt;
         ClearErrors&lt;br /&gt;
&lt;br /&gt;
         Exch $0&lt;br /&gt;
         ;DetailPrint &amp;quot;ASDF - $0\..&amp;quot;&lt;br /&gt;
         RMDir &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         IfErrors Skip&lt;br /&gt;
         ${RMDirUP} &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         Skip:&lt;br /&gt;
         &lt;br /&gt;
         Pop $0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The function declaration (as above) must appear before the call in the installation script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
RMDir /r &amp;quot;$INSTDIR&amp;quot;     ;remove $INSTDIR and all files/subfolders&lt;br /&gt;
${RMDirUP} &amp;quot;$INSTDIR&amp;quot;   ;remove $INSTDIR&#039;s parents (if each is empty ONLY)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Another function (by jiake) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
	Push $R2&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	# Strip the last backslash&lt;br /&gt;
	StrCpy $R1 $R0 &amp;quot;&amp;quot; -1&lt;br /&gt;
	StrCmp $R1 &amp;quot;\&amp;quot; 0 +2&lt;br /&gt;
	StrCpy $R0 $R0 -1&lt;br /&gt;
	# Check if it is root path&lt;br /&gt;
	StrCpy $R1 $R0 2&lt;br /&gt;
	StrCmp $R1 $R0 lbl_end&lt;br /&gt;
	# Check if it is empty&lt;br /&gt;
	FindFirst $R1 $R2 &amp;quot;$R0\*.*&amp;quot;&lt;br /&gt;
lbl_dir:&lt;br /&gt;
	StrCmp $R2 &amp;quot;.&amp;quot; +2&lt;br /&gt;
	StrCmp $R2 &amp;quot;..&amp;quot; 0 +3&lt;br /&gt;
	FindNext $R1 $R2&lt;br /&gt;
	Goto lbl_dir&lt;br /&gt;
	FindClose $R1&lt;br /&gt;
	# After skipping &amp;quot;.&amp;quot; &amp;amp; &amp;quot;..&amp;quot;&lt;br /&gt;
	StrCmp $R2 &amp;quot;&amp;quot; 0 lbl_end&lt;br /&gt;
	# No more files found, it is an empty folder&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	# Get the parent folder and then loop&lt;br /&gt;
	GetFullPathName $R0 &amp;quot;$R0\..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R2&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
# Calling Windows API version&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAddBackslash(tR0R0)&amp;quot;&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsRoot(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 0 lbl_end&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsDirectoryEmpty(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 lbl_end&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAppend(tR0R0,ts)&amp;quot; &amp;quot;..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
Section -Test&lt;br /&gt;
	# Create a temp direcotry&lt;br /&gt;
	CreateDirectory &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	# Remove empty directories recursively&lt;br /&gt;
	Push &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	Call RecursiveRemoveEmptyDirectory&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
If a directory include more than one empty sub directories, this function fails.&lt;br /&gt;
&lt;br /&gt;
[[Category:Disk, Path &amp;amp; File Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=23898</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=23898"/>
		<updated>2013-07-26T14:14:33Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above) ===&lt;br /&gt;
I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here. Any question please email jiake(at)vip.qq.com.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A variable to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} (0) A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  (1) A limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} (2) An administrator account.&lt;br /&gt;
;     error                  An error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23897</id>
		<title>Recursively remove empty parent directories</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23897"/>
		<updated>2013-07-26T08:51:25Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Another function (by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|ParallaxTZ}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This function and example function call can be used to recursively delete empty parent folders of a given folder. &lt;br /&gt;
&lt;br /&gt;
(Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com))&lt;br /&gt;
&lt;br /&gt;
== The Script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function un.RMDirUP&lt;br /&gt;
         !define RMDirUP &#039;!insertmacro RMDirUPCall&#039;&lt;br /&gt;
&lt;br /&gt;
         !macro RMDirUPCall _PATH&lt;br /&gt;
                push &#039;${_PATH}&#039;&lt;br /&gt;
                Call un.RMDirUP&lt;br /&gt;
         !macroend&lt;br /&gt;
&lt;br /&gt;
         ; $0 - current folder&lt;br /&gt;
         ClearErrors&lt;br /&gt;
&lt;br /&gt;
         Exch $0&lt;br /&gt;
         ;DetailPrint &amp;quot;ASDF - $0\..&amp;quot;&lt;br /&gt;
         RMDir &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         IfErrors Skip&lt;br /&gt;
         ${RMDirUP} &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         Skip:&lt;br /&gt;
         &lt;br /&gt;
         Pop $0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The function declaration (as above) must appear before the call in the installation script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
RMDir /r &amp;quot;$INSTDIR&amp;quot;     ;remove $INSTDIR and all files/subfolders&lt;br /&gt;
${RMDirUP} &amp;quot;$INSTDIR&amp;quot;   ;remove $INSTDIR&#039;s parents (if each is empty ONLY)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Another function (by jiake) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
	Push $R2&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	# Strip the last backslash&lt;br /&gt;
	StrCpy $R1 $R0 &amp;quot;&amp;quot; -1&lt;br /&gt;
	StrCmp $R1 &amp;quot;\&amp;quot; 0 +2&lt;br /&gt;
	StrCpy $R0 $R0 -1&lt;br /&gt;
	# Check if it is root path&lt;br /&gt;
	StrCpy $R1 $R0 2&lt;br /&gt;
	StrCmp $R1 $R0 lbl_end&lt;br /&gt;
	# Check if it is empty&lt;br /&gt;
	FindFirst $R1 $R2 &amp;quot;$R0\*.*&amp;quot;&lt;br /&gt;
lbl_dir:&lt;br /&gt;
	StrCmp $R2 &amp;quot;.&amp;quot; +2&lt;br /&gt;
	StrCmp $R2 &amp;quot;..&amp;quot; 0 +3&lt;br /&gt;
	FindNext $R1 $R2&lt;br /&gt;
	Goto lbl_dir&lt;br /&gt;
	FindClose $R1&lt;br /&gt;
	# After skip &amp;quot;.&amp;quot; &amp;amp; &amp;quot;..&amp;quot;&lt;br /&gt;
	StrCmp $R2 &amp;quot;&amp;quot; 0 lbl_end&lt;br /&gt;
	# No more files found, it is an empty folder&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	# Get the parent folder the loop&lt;br /&gt;
	GetFullPathName $R0 &amp;quot;$R0\..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R2&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
# Calling Windows API version&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAddBackslash(tR0R0)&amp;quot;&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsRoot(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 0 lbl_end&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsDirectoryEmpty(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 lbl_end&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAppend(tR0R0,ts)&amp;quot; &amp;quot;..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
Section -Test&lt;br /&gt;
	# Create a temp direcotry&lt;br /&gt;
	CreateDirectory &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	# Recursive remove empty directories&lt;br /&gt;
	Push &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	Call RecursiveRemoveEmptyDirectory&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
If a directory include more than one empty sub directories, this function fails.&lt;br /&gt;
&lt;br /&gt;
[[Category:Disk, Path &amp;amp; File Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23896</id>
		<title>Recursively remove empty parent directories</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23896"/>
		<updated>2013-07-26T07:43:47Z</updated>

		<summary type="html">&lt;p&gt;550771955: Windows API version added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|ParallaxTZ}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This function and example function call can be used to recursively delete empty parent folders of a given folder. &lt;br /&gt;
&lt;br /&gt;
(Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com))&lt;br /&gt;
&lt;br /&gt;
== The Script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function un.RMDirUP&lt;br /&gt;
         !define RMDirUP &#039;!insertmacro RMDirUPCall&#039;&lt;br /&gt;
&lt;br /&gt;
         !macro RMDirUPCall _PATH&lt;br /&gt;
                push &#039;${_PATH}&#039;&lt;br /&gt;
                Call un.RMDirUP&lt;br /&gt;
         !macroend&lt;br /&gt;
&lt;br /&gt;
         ; $0 - current folder&lt;br /&gt;
         ClearErrors&lt;br /&gt;
&lt;br /&gt;
         Exch $0&lt;br /&gt;
         ;DetailPrint &amp;quot;ASDF - $0\..&amp;quot;&lt;br /&gt;
         RMDir &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         IfErrors Skip&lt;br /&gt;
         ${RMDirUP} &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         Skip:&lt;br /&gt;
         &lt;br /&gt;
         Pop $0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The function declaration (as above) must appear before the call in the installation script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
RMDir /r &amp;quot;$INSTDIR&amp;quot;     ;remove $INSTDIR and all files/subfolders&lt;br /&gt;
${RMDirUP} &amp;quot;$INSTDIR&amp;quot;   ;remove $INSTDIR&#039;s parents (if each is empty ONLY)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Another function (by jiake) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
	Push $R2&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	# Strip the last backslash&lt;br /&gt;
	StrCpy $R1 $R0 &amp;quot;&amp;quot; -1&lt;br /&gt;
	StrCmp $R1 &amp;quot;\&amp;quot; 0 +2&lt;br /&gt;
	StrCpy $R0 $R0 -1&lt;br /&gt;
	# Check if it is root path&lt;br /&gt;
	StrCpy $R1 $R0 2&lt;br /&gt;
	StrCmp $R1 $R0 lbl_end&lt;br /&gt;
	# Check if it is empty&lt;br /&gt;
	FindFirst $R1 $R2 &amp;quot;$R0\*.*&amp;quot;&lt;br /&gt;
lbl_find:&lt;br /&gt;
	StrCmp $R2 &amp;quot;.&amp;quot; +2&lt;br /&gt;
	StrCmp $R2 &amp;quot;..&amp;quot; 0 +3&lt;br /&gt;
	FindNext $R1 $R2&lt;br /&gt;
	Goto lbl_dir&lt;br /&gt;
	FindClose $R1&lt;br /&gt;
	# After skip &amp;quot;.&amp;quot; &amp;amp; &amp;quot;..&amp;quot;&lt;br /&gt;
	StrCmp $R2 &amp;quot;&amp;quot; 0 lbl_end&lt;br /&gt;
	# No more files found, it is an empty folder&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	# Get the parent folder the loop&lt;br /&gt;
	GetFullPathName $R0 &amp;quot;$R0\..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R2&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
# Calling Windows API version&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAddBackslash(tR0R0)&amp;quot;&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsRoot(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 0 lbl_end&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsDirectoryEmpty(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 lbl_end&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAppend(tR0R0,ts)&amp;quot; &amp;quot;..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
Section -Test&lt;br /&gt;
	# Create a temp direcotry&lt;br /&gt;
	CreateDirectory &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	# Recursive remove empty directories&lt;br /&gt;
	Push &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	Call RecursiveRemoveEmptyDirectory&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
If a directory include more than one empty sub directories, this function fails.&lt;br /&gt;
&lt;br /&gt;
[[Category:Disk, Path &amp;amp; File Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23895</id>
		<title>Recursively remove empty parent directories</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23895"/>
		<updated>2013-07-26T07:42:03Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Another function (by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|ParallaxTZ}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This function and example function call can be used to recursively delete empty parent folders of a given folder. &lt;br /&gt;
&lt;br /&gt;
(Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com))&lt;br /&gt;
&lt;br /&gt;
== The Script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function un.RMDirUP&lt;br /&gt;
         !define RMDirUP &#039;!insertmacro RMDirUPCall&#039;&lt;br /&gt;
&lt;br /&gt;
         !macro RMDirUPCall _PATH&lt;br /&gt;
                push &#039;${_PATH}&#039;&lt;br /&gt;
                Call un.RMDirUP&lt;br /&gt;
         !macroend&lt;br /&gt;
&lt;br /&gt;
         ; $0 - current folder&lt;br /&gt;
         ClearErrors&lt;br /&gt;
&lt;br /&gt;
         Exch $0&lt;br /&gt;
         ;DetailPrint &amp;quot;ASDF - $0\..&amp;quot;&lt;br /&gt;
         RMDir &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         IfErrors Skip&lt;br /&gt;
         ${RMDirUP} &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         Skip:&lt;br /&gt;
         &lt;br /&gt;
         Pop $0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The function declaration (as above) must appear before the call in the installation script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
RMDir /r &amp;quot;$INSTDIR&amp;quot;     ;remove $INSTDIR and all files/subfolders&lt;br /&gt;
${RMDirUP} &amp;quot;$INSTDIR&amp;quot;   ;remove $INSTDIR&#039;s parents (if each is empty ONLY)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Another function (by jiake) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
	Push $R2&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	# Strip the last backslash&lt;br /&gt;
	StrCpy $R1 $R0 &amp;quot;&amp;quot; -1&lt;br /&gt;
	StrCmp $R1 &amp;quot;\&amp;quot; 0 +2&lt;br /&gt;
	StrCpy $R0 $R0 -1&lt;br /&gt;
	# Check if it is root path&lt;br /&gt;
	StrCpy $R1 $R0 2&lt;br /&gt;
	StrCmp $R1 $R0 lbl_end&lt;br /&gt;
	# Check if it is empty&lt;br /&gt;
	FindFirst $R1 $R2 &amp;quot;$R0\*.*&amp;quot;&lt;br /&gt;
lbl_find:&lt;br /&gt;
	StrCmp $R2 &amp;quot;.&amp;quot; +2&lt;br /&gt;
	StrCmp $R2 &amp;quot;..&amp;quot; 0 +3&lt;br /&gt;
	FindNext $R1 $R2&lt;br /&gt;
	Goto lbl_dir&lt;br /&gt;
	FindClose $R1&lt;br /&gt;
	# After skip &amp;quot;.&amp;quot; &amp;amp; &amp;quot;..&amp;quot;&lt;br /&gt;
	StrCmp $R2 &amp;quot;&amp;quot; 0 lbl_end&lt;br /&gt;
	# No more files found, it is an empty folder&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	# Get the parent folder the loop&lt;br /&gt;
	GetFullPathName $R0 &amp;quot;$R0\..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R2&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
# Call Windows API version&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAddBackslash(tR0R0)&amp;quot;&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsRoot(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 0 lbl_end&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathIsDirectoryEmpty(tR0)i.R1&amp;quot;&lt;br /&gt;
	StrCmp $R1 0 lbl_end&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	System::Call &amp;quot;shlwapi::PathAppend(tR0R0,ts)&amp;quot; &amp;quot;..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
Section -Test&lt;br /&gt;
	# Create a temp direcotry&lt;br /&gt;
	CreateDirectory &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	# Recursive remove empty directories&lt;br /&gt;
	Push &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	Call RecursiveRemoveEmptyDirectory&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
If a directory include more than one empty sub directories, this function fails.&lt;br /&gt;
&lt;br /&gt;
[[Category:Disk, Path &amp;amp; File Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23894</id>
		<title>Recursively remove empty parent directories</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Recursively_remove_empty_parent_directories&amp;diff=23894"/>
		<updated>2013-07-26T07:38:49Z</updated>

		<summary type="html">&lt;p&gt;550771955: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|ParallaxTZ}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This function and example function call can be used to recursively delete empty parent folders of a given folder. &lt;br /&gt;
&lt;br /&gt;
(Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com))&lt;br /&gt;
&lt;br /&gt;
== The Script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function un.RMDirUP&lt;br /&gt;
         !define RMDirUP &#039;!insertmacro RMDirUPCall&#039;&lt;br /&gt;
&lt;br /&gt;
         !macro RMDirUPCall _PATH&lt;br /&gt;
                push &#039;${_PATH}&#039;&lt;br /&gt;
                Call un.RMDirUP&lt;br /&gt;
         !macroend&lt;br /&gt;
&lt;br /&gt;
         ; $0 - current folder&lt;br /&gt;
         ClearErrors&lt;br /&gt;
&lt;br /&gt;
         Exch $0&lt;br /&gt;
         ;DetailPrint &amp;quot;ASDF - $0\..&amp;quot;&lt;br /&gt;
         RMDir &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         &lt;br /&gt;
         IfErrors Skip&lt;br /&gt;
         ${RMDirUP} &amp;quot;$0\..&amp;quot;&lt;br /&gt;
         Skip:&lt;br /&gt;
         &lt;br /&gt;
         Pop $0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The function declaration (as above) must appear before the call in the installation script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
RMDir /r &amp;quot;$INSTDIR&amp;quot;     ;remove $INSTDIR and all files/subfolders&lt;br /&gt;
${RMDirUP} &amp;quot;$INSTDIR&amp;quot;   ;remove $INSTDIR&#039;s parents (if each is empty ONLY)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Another function (by jiake) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function RecursiveRemoveEmptyDirectory&lt;br /&gt;
	Exch $R0&lt;br /&gt;
	Push $R1&lt;br /&gt;
	Push $R2&lt;br /&gt;
lbl_loop:&lt;br /&gt;
	# Strip the last backslash&lt;br /&gt;
	StrCpy $R1 $R0 &amp;quot;&amp;quot; -1&lt;br /&gt;
	StrCmp $R1 &amp;quot;\&amp;quot; 0 +2&lt;br /&gt;
	StrCpy $R0 $R0 -1&lt;br /&gt;
	# Check if it is root path&lt;br /&gt;
	StrCpy $R1 $R0 2&lt;br /&gt;
	StrCmp $R1 $R0 lbl_end&lt;br /&gt;
	# Check if it is empty&lt;br /&gt;
	FindFirst $R1 $R2 &amp;quot;$R0\*.*&amp;quot;&lt;br /&gt;
lbl_find:&lt;br /&gt;
	StrCmp $R2 &amp;quot;.&amp;quot; +2&lt;br /&gt;
	StrCmp $R2 &amp;quot;..&amp;quot; 0 +3&lt;br /&gt;
	FindNext $R1 $R2&lt;br /&gt;
	Goto lbl_dir&lt;br /&gt;
	FindClose $R1&lt;br /&gt;
	# After skip &amp;quot;.&amp;quot; &amp;amp; &amp;quot;..&amp;quot;&lt;br /&gt;
	StrCmp $R2 &amp;quot;&amp;quot; 0 lbl_end&lt;br /&gt;
	# No more files found, it is an empty folder&lt;br /&gt;
	RMDir $R0&lt;br /&gt;
	# Get the parent folder the loop&lt;br /&gt;
	GetFullPathName $R0 &amp;quot;$R0\..&amp;quot;&lt;br /&gt;
	Goto lbl_loop&lt;br /&gt;
lbl_end:&lt;br /&gt;
	Pop $R2&lt;br /&gt;
	Pop $R1&lt;br /&gt;
	Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Test&lt;br /&gt;
	# Create a temp direcotry&lt;br /&gt;
	CreateDirectory &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	# Recursive remove empty directories&lt;br /&gt;
	Push &amp;quot;$TEMP\1\22\333\4444\55555&amp;quot;&lt;br /&gt;
	Call RecursiveRemoveEmptyDirectory&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
If a directory include more than one empty sub directories, this function fails.&lt;br /&gt;
&lt;br /&gt;
[[Category:Disk, Path &amp;amp; File Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NsDialogs_CreateIPaddress&amp;diff=23725</id>
		<title>NsDialogs CreateIPaddress</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NsDialogs_CreateIPaddress&amp;diff=23725"/>
		<updated>2013-06-15T08:08:56Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
This header is an extension to the existing nsDialogs.nsh header file, and adds the ability to create IP address controls via a new ${NSD_CreateIPaddress} command.  IP address controls look like a standard edit (text) control, but separated logically by 3 dots, where each of the 4 parts only accepts numbers within the range 0 .. 255.  An IP address control is the logical choice when requiting IP address input.&lt;br /&gt;
ofer&lt;br /&gt;
&lt;br /&gt;
== Attribution ==&lt;br /&gt;
This header is the result of the forum discussion [http://forums.winamp.com/showthread.php?threadid=302172 nsDialogs IP Address Control], and credit goes largely to Xokar and Anders for the correct system calls and to the nsDialogs header team for the conventions laid out therein.&lt;br /&gt;
&lt;br /&gt;
A fix for a font corruption bug stems from the forum discussion [http://forums.winamp.com/showthread.php?t=318497 Problem of NSD_CreateIPAddress.nsh ]&lt;br /&gt;
&lt;br /&gt;
== Header ==&lt;br /&gt;
* Main download link: &amp;lt;attach&amp;gt;Nsdialogs_createIpaddress.zip&amp;lt;/attach&amp;gt;.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=&amp;quot;gray&amp;quot; size=&amp;quot;1&amp;quot;&amp;gt;MD5: 23e8d124fadf7f9af7ea865fe495675a | Filesize: 1023B &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating ==&lt;br /&gt;
Although typically the various internet controls may already be initialized on your system, it is a good idea to make sure they are indeed initialized.  For the IPaddress control, use ${NSD_InitIPaddress} to initialize the control.  If used, this should only be needed once (e.g. in .onGuiInit).&lt;br /&gt;
&lt;br /&gt;
Creating the IPaddress control is as simple as creating any other control, using &#039;${NSD_CreateIPaddress} top left width height &amp;quot;&amp;quot;&#039;.  Note that the IP address control does not take any label text and is thus left blank.&lt;br /&gt;
&lt;br /&gt;
== Writing ==&lt;br /&gt;
You can set the IP address using the existing &#039;${NSD_SetText}&#039; function.  For example: &#039;${NSD_SetText} &amp;lt;control&amp;gt; &amp;quot;192.168.0.0&amp;quot;&#039;.  The accepted text must be a valid IP address of format #.#.#.# .&lt;br /&gt;
&lt;br /&gt;
== Callbacks ==&lt;br /&gt;
The IPaddress control only triggers the &#039;${NSD_OnNotify}&#039; callback.  This callback is triggered in two cases:&lt;br /&gt;
   * twice after one part of an IP address is entered (once for the entered text, once again for&amp;lt;br&amp;gt;the next part receiving focus).  To separate the two events, set a temporary variable.&lt;br /&gt;
   * once after the IP address control loses focus (user tabs out, clicks out, etc.)&lt;br /&gt;
&lt;br /&gt;
If you want to do some type of validation on the IP address entered once the control loses focus you will have to get the focus of the current control and compare that to the four hwnds of each of the IP address fields.&lt;br /&gt;
&lt;br /&gt;
You can get each of the fields using:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
FindWindow $Field4 &amp;quot;&amp;quot; &amp;quot;&amp;quot; $IPAddressControl&lt;br /&gt;
FindWindow $Field3 &amp;quot;&amp;quot; &amp;quot;&amp;quot; $IPAddressControl $Field4&lt;br /&gt;
FindWindow $Field2 &amp;quot;&amp;quot; &amp;quot;&amp;quot; $IPAddressControl $Field3&lt;br /&gt;
FindWindow $Field1 &amp;quot;&amp;quot; &amp;quot;&amp;quot; $IPAddressControl $Field2&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can get the hwnd of the control that currently has focus using:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
System::Call &amp;quot;user32::GetFocus(v) i.r0&amp;quot; ; $0 now contains the hwnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this information you can check if, after a notification, one of the 4 IP address fields has focus, or whether focus was lost from all the IP address fields; using LogicLib:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
${Select} $0&lt;br /&gt;
	${Case} $Field1&lt;br /&gt;
	${Case} $Field2&lt;br /&gt;
	${Case} $Field3&lt;br /&gt;
	${Case} $Field4&lt;br /&gt;
	${Default}&lt;br /&gt;
		; process here&lt;br /&gt;
${EndSelect}&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ==&lt;br /&gt;
To read the IP address entered, you can use the existing &#039;${NSD_GetText} &amp;lt;control&amp;gt; &amp;lt;outvar&amp;gt;&#039; convention.  The IP address is returned as a single string of format #.#.#.# .  If you need to check pieces of the IP address, you will have to manually separate it into the appropriate pieces using existing string manipulation functions.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
outfile &#039;nsdialogs_createIPaddress.exe&#039;&lt;br /&gt;
&lt;br /&gt;
!include &#039;nsdialogs.nsh&#039;&lt;br /&gt;
!include &#039;nsdialogs_createIPaddress.nsh&#039;&lt;br /&gt;
&lt;br /&gt;
Page Custom CustomPre&lt;br /&gt;
&lt;br /&gt;
Function CustomPre&lt;br /&gt;
	nsDialogs::Create 1018&lt;br /&gt;
	Pop $R0&lt;br /&gt;
&lt;br /&gt;
	${If} $R0 == error&lt;br /&gt;
		Abort&lt;br /&gt;
	${EndIf}&lt;br /&gt;
&lt;br /&gt;
	; This would more appropriately be called in .onGUIInit&lt;br /&gt;
	${NSD_InitIPaddress}&lt;br /&gt;
	Pop $0&lt;br /&gt;
	IntCmp $0 0 0 +3 +3&lt;br /&gt;
	MessageBox MB_OK &amp;quot;Something went wrong while initializing the IPaddress control&amp;quot;&lt;br /&gt;
	Abort&lt;br /&gt;
&lt;br /&gt;
	${NSD_CreateIPaddress} 5% 90% 30% 12u &amp;quot;&amp;quot;&lt;br /&gt;
	Pop $0&lt;br /&gt;
&lt;br /&gt;
	nsDialogs::Show&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Styling ==&lt;br /&gt;
Note that due to the nature of the control, you can only apply limited styling.  For example, changing the background color of the control will result in an incorrectly painted control, while attempts to change the background color of any of the 4 fields will result in a crash.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]] [[Category:Code Examples]] [[Category:nsDialogs Examples]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ThreadTimer_v1.1.1.7z&amp;diff=22165</id>
		<title>File:ThreadTimer v1.1.1.7z</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ThreadTimer_v1.1.1.7z&amp;diff=22165"/>
		<updated>2012-07-13T17:54:49Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ThreadTimer v1.1.1.7z&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22164</id>
		<title>ThreadTimer plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22164"/>
		<updated>2012-07-13T17:45:06Z</updated>

		<summary type="html">&lt;p&gt;550771955: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Download Link ==&lt;br /&gt;
v1.1.1 (updated 14th, July 2012) by [[User:550771955|jiake]] &amp;lt;attach&amp;gt;ThreadTimer_v1.1.1.7z&amp;lt;/attach&amp;gt;, with tlibc static library.&lt;br /&gt;
&lt;br /&gt;
v1.1 (updated October 2011) by [[User:Slappy|Slappy]] &amp;lt;attach&amp;gt;ThreadTimer.zip&amp;lt;/attach&amp;gt; [http://forums.winamp.com/showthread.php?t=331275 Forum thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
ThreadTimer plug-in allows you to create simple Timer which runs in a &#039;&#039;&#039;separate thread&#039;&#039;&#039;.&lt;br /&gt;
It is available since Start until Stop, it ticks in desired interval and calls NSIS function.&lt;br /&gt;
It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page.&lt;br /&gt;
&lt;br /&gt;
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below)&lt;br /&gt;
&lt;br /&gt;
[[File:SkinnedControls-Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
See simple example below for fast start.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Start Function ===&lt;br /&gt;
&lt;br /&gt;
Initializes Timer and starts it immediately.&lt;br /&gt;
NSIS Function will be called first time Interval milliseconds after calling Start.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
&lt;br /&gt;
/NOUNLOAD&lt;br /&gt;
:This must be defined! Plug-in will crash without this parameter! Note: version 1.1.1 do not need.&lt;br /&gt;
&lt;br /&gt;
Interval&lt;br /&gt;
:Interval for timer [milliseconds]. Timer ticks each Interval and calls NSIS Function.&lt;br /&gt;
&lt;br /&gt;
Ticks&lt;br /&gt;
:Number of ticks for Timer. 0 or -1 for infinite loop. (v1.1.1, any value that less than or equal to 0 meant infinite loop).&lt;br /&gt;
&lt;br /&gt;
NSIS Function&lt;br /&gt;
:Address of NSIS function to call from plug-in. Use GetFunctionAddress to obtain this address of your function.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Stop Function ===&lt;br /&gt;
&lt;br /&gt;
Stops the timer immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function TryMe&lt;br /&gt;
  MessageBox MB_OK &amp;quot;TryMe&amp;quot;&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExample&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ; Note: version 1.1.1 do not need /NOUNLOAD switch. &lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 2345 8 $2 ; Timer ticks every 2345 milliseconds, totally 8 times calls TryMe&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExampleInfiniteLoop&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ; Note: version 1.1.1 do not need /NOUNLOAD switch.&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 1234 -1 $2 ; Timer ticks every 1234 milliseconds, it calls function TryMe in infinite loop until ThreadTimer::Stop is called&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function .onGUIEnd&lt;br /&gt;
  ThreadTimer::Stop&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
There are several important facts to know about this plug-in:&lt;br /&gt;
* Timer runs in separate thread. If you forget to call ThreadTimer::Stop it will still run however your NSIS installer exists! This may cause (and often causes) crash!&lt;br /&gt;
* There is no error handling in this version, be careful with parameters!&lt;br /&gt;
* If you need to execute some function periodically in whole life of installer (on each page, also while installing files, ...) use ThreadTimer::Start in your .onInit function.&lt;br /&gt;
* It is nice habit to call ThreadTimer::Stop in your .onGUIEnd function.&lt;br /&gt;
* Plug-in does not use SetTimer and KillTimer WinAPI functions. Instead it creates a new thread and uses Sleep() to wait for desired Interval. There might be a little inaccuracy in time periods!&lt;br /&gt;
&lt;br /&gt;
== Versions History ==&lt;br /&gt;
;1.1.1 (July 2012)(by jiake)&lt;br /&gt;
* Update it so that you can remove /NOUNLOAD switch when using in NSIS&lt;br /&gt;
* Remove unused code from source&lt;br /&gt;
* Size 3.5kB(ANSI)/3kB(Unicode)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.1 (October 2011)&lt;br /&gt;
* Second version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Pure C code - removed all dependencies on CRT but included TinyC lib&lt;br /&gt;
* Removed decorated names of calls&lt;br /&gt;
* Size ~4kB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.0 (2011)&lt;br /&gt;
* First version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Removed dependency on MS VCR 9.0 runtime (Bigger size of dll).&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
*Version 1.0 by [[User:Slappy|Slappy]] Graphical installers: [http://www.unsigned-softworks.sk www.unsigned-softworks.sk]&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22163</id>
		<title>ThreadTimer plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22163"/>
		<updated>2012-07-13T17:37:18Z</updated>

		<summary type="html">&lt;p&gt;550771955: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Download Link ==&lt;br /&gt;
v1.1.1 (updated 14th, July 2012) by [[User:550771955|jiake]] &amp;lt;attach&amp;gt;ThreadTimer_v1.1.1.zip&amp;lt;/attach&amp;gt;()&lt;br /&gt;
&lt;br /&gt;
v1.1 (updated October 2011) by [[User:Slappy|Slappy]] &amp;lt;attach&amp;gt;ThreadTimer.zip&amp;lt;/attach&amp;gt; [http://forums.winamp.com/showthread.php?t=331275 Forum thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
ThreadTimer plug-in allows you to create simple Timer which runs in a &#039;&#039;&#039;separate thread&#039;&#039;&#039;.&lt;br /&gt;
It is available since Start until Stop, it ticks in desired interval and calls NSIS function.&lt;br /&gt;
It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page.&lt;br /&gt;
&lt;br /&gt;
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below)&lt;br /&gt;
&lt;br /&gt;
[[File:SkinnedControls-Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
See simple example below for fast start.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Start Function ===&lt;br /&gt;
&lt;br /&gt;
Initializes Timer and starts it immediately.&lt;br /&gt;
NSIS Function will be called first time Interval milliseconds after calling Start.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
&lt;br /&gt;
/NOUNLOAD&lt;br /&gt;
:This must be defined! Plug-in will crash without this parameter! Note: version 1.1.1 do not need.&lt;br /&gt;
&lt;br /&gt;
Interval&lt;br /&gt;
:Interval for timer [milliseconds]. Timer ticks each Interval and calls NSIS Function.&lt;br /&gt;
&lt;br /&gt;
Ticks&lt;br /&gt;
:Number of ticks for Timer. 0 or -1 for infinite loop.&lt;br /&gt;
&lt;br /&gt;
NSIS Function&lt;br /&gt;
:Address of NSIS function to call from plug-in. Use GetFunctionAddress to obtain this address of your function.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Stop Function ===&lt;br /&gt;
&lt;br /&gt;
Stops the timer immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function TryMe&lt;br /&gt;
  MessageBox MB_OK &amp;quot;TryMe&amp;quot;&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExample&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ; Note: version 1.1.1 do not need /NOUNLOAD switch. &lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 2345 8 $2 ; Timer ticks every 2345 milliseconds, totally 8 times calls TryMe&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExampleInfiniteLoop&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ; Note: version 1.1.1 do not need /NOUNLOAD switch.&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 1234 -1 $2 ; Timer ticks every 1234 milliseconds, it calls function TryMe in infinite loop until ThreadTimer::Stop is called&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function .onGUIEnd&lt;br /&gt;
  ThreadTimer::Stop&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
There are several important facts to know about this plug-in:&lt;br /&gt;
* Timer runs in separate thread. If you forget to call ThreadTimer::Stop it will still run however your NSIS installer exists! This may cause (and often causes) crash!&lt;br /&gt;
* There is no error handling in this version, be careful with parameters!&lt;br /&gt;
* If you need to execute some function periodically in whole life of installer (on each page, also while installing files, ...) use ThreadTimer::Start in your .onInit function.&lt;br /&gt;
* It is nice habit to call ThreadTimer::Stop in your .onGUIEnd function.&lt;br /&gt;
* Plug-in does not use SetTimer and KillTimer WinAPI functions. Instead it creates a new thread and uses Sleep() to wait for desired Interval. There might be a little inaccuracy in time periods!&lt;br /&gt;
&lt;br /&gt;
== Versions History ==&lt;br /&gt;
;1.1.1 (July 2012)(by jiake)&lt;br /&gt;
* Update it so that you can remove /NOUNLOAD switch when using in NSIS&lt;br /&gt;
* Remove unused code from source&lt;br /&gt;
* Size 3.5kB(ANSI)/3kB(Unicode)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.1 (October 2011)&lt;br /&gt;
* Second version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Pure C code - removed all dependencies on CRT but included TinyC lib&lt;br /&gt;
* Removed decorated names of calls&lt;br /&gt;
* Size ~4kB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.0 (2011)&lt;br /&gt;
* First version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Removed dependency on MS VCR 9.0 runtime (Bigger size of dll).&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
*Version 1.0 by [[User:Slappy|Slappy]] Graphical installers: [http://www.unsigned-softworks.sk www.unsigned-softworks.sk]&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ThreadTimer_v1.1.1.7z&amp;diff=22162</id>
		<title>File:ThreadTimer v1.1.1.7z</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ThreadTimer_v1.1.1.7z&amp;diff=22162"/>
		<updated>2012-07-13T17:35:07Z</updated>

		<summary type="html">&lt;p&gt;550771955: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22161</id>
		<title>ThreadTimer plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22161"/>
		<updated>2012-07-13T17:28:56Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Download Link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Download Link ==&lt;br /&gt;
v1.1.1 (updated 14th, July 2012) by [[User:550771955|jiake]] &amp;lt;attach&amp;gt;ThreadTimer_v1.1.1.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
v1.1 (updated October 2011) by [[User:Slappy|Slappy]] &amp;lt;attach&amp;gt;ThreadTimer.zip&amp;lt;/attach&amp;gt; [http://forums.winamp.com/showthread.php?t=331275 Forum thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
ThreadTimer plug-in allows you to create simple Timer which runs in a &#039;&#039;&#039;separate thread&#039;&#039;&#039;.&lt;br /&gt;
It is available since Start until Stop, it ticks in desired interval and calls NSIS function.&lt;br /&gt;
It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page.&lt;br /&gt;
&lt;br /&gt;
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below)&lt;br /&gt;
&lt;br /&gt;
[[File:SkinnedControls-Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
See simple example below for fast start.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Start Function ===&lt;br /&gt;
&lt;br /&gt;
Initializes Timer and starts it immediately.&lt;br /&gt;
NSIS Function will be called first time Interval milliseconds after calling Start.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
&lt;br /&gt;
/NOUNLOAD&lt;br /&gt;
: This must be defined! Plug-in will crash without this parameter!&lt;br /&gt;
&lt;br /&gt;
Interval&lt;br /&gt;
:Interval for timer [milliseconds]. Timer ticks each Interval and calls NSIS Function.&lt;br /&gt;
&lt;br /&gt;
Ticks&lt;br /&gt;
:Number of ticks for Timer. 0 or -1 for infinite loop.&lt;br /&gt;
&lt;br /&gt;
NSIS Function&lt;br /&gt;
:Address of NSIS function to call from plug-in. Use GetFunctionAddress to obtain this address of your function.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Stop Function ===&lt;br /&gt;
&lt;br /&gt;
Stops the timer immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function TryMe&lt;br /&gt;
  MessageBox MB_OK &amp;quot;TryMe&amp;quot;&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExample&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 2345 8 $2 ; Timer ticks every 2345 milliseconds, totally 8 times calls TryMe&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExampleInfiniteLoop&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 1234 -1 $2 ; Timer ticks every 1234 milliseconds, it calls function TryMe in infinite loop until ThreadTimer::Stop is called&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function .onGUIEnd&lt;br /&gt;
	ThreadTimer::Stop&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
There are several important facts to know about this plug-in:&lt;br /&gt;
* Timer runs in separate thread. If you forget to call ThreadTimer::Stop it will still run however your NSIS installer exists! This may cause (and often causes) crash!&lt;br /&gt;
* There is no error handling in this version, be careful with parameters!&lt;br /&gt;
* If you need to execute some function periodically in whole life of installer (on each page, also while installing files, ...) use ThreadTimer::Start in your .onInit function.&lt;br /&gt;
* It is nice habit to call ThreadTimer::Stop in your .onGUIEnd function.&lt;br /&gt;
* Plug-in does not use SetTimer and KillTimer WinAPI functions. Instead it creates a new thread and uses Sleep() to wait for desired Interval. There might be a little inaccuracy in time periods!&lt;br /&gt;
&lt;br /&gt;
== Versions History ==&lt;br /&gt;
;1.1.1 (July 2012)(by jiake)&lt;br /&gt;
* Update it so that you can remove /NOUNLOAD switch when using in NSIS&lt;br /&gt;
* Remove unused code from source&lt;br /&gt;
* Size 3.5kB(ANSI)/3kB(Unicode)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.1 (October 2011)&lt;br /&gt;
* Second version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Pure C code - removed all dependencies on CRT but included TinyC lib&lt;br /&gt;
* Removed decorated names of calls&lt;br /&gt;
* Size ~4kB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.0 (2011)&lt;br /&gt;
* First version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Removed dependency on MS VCR 9.0 runtime (Bigger size of dll).&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
*Version 1.0 by [[User:Slappy|Slappy]] Graphical installers: [http://www.unsigned-softworks.sk www.unsigned-softworks.sk]&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22160</id>
		<title>ThreadTimer plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22160"/>
		<updated>2012-07-13T17:28:23Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Versions History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Download Link ==&lt;br /&gt;
v1.1 (updated October 2011) by [[User:Slappy|Slappy]] &amp;lt;attach&amp;gt;ThreadTimer.zip&amp;lt;/attach&amp;gt; [http://forums.winamp.com/showthread.php?t=331275 Forum thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
ThreadTimer plug-in allows you to create simple Timer which runs in a &#039;&#039;&#039;separate thread&#039;&#039;&#039;.&lt;br /&gt;
It is available since Start until Stop, it ticks in desired interval and calls NSIS function.&lt;br /&gt;
It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page.&lt;br /&gt;
&lt;br /&gt;
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below)&lt;br /&gt;
&lt;br /&gt;
[[File:SkinnedControls-Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
See simple example below for fast start.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Start Function ===&lt;br /&gt;
&lt;br /&gt;
Initializes Timer and starts it immediately.&lt;br /&gt;
NSIS Function will be called first time Interval milliseconds after calling Start.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
&lt;br /&gt;
/NOUNLOAD&lt;br /&gt;
: This must be defined! Plug-in will crash without this parameter!&lt;br /&gt;
&lt;br /&gt;
Interval&lt;br /&gt;
:Interval for timer [milliseconds]. Timer ticks each Interval and calls NSIS Function.&lt;br /&gt;
&lt;br /&gt;
Ticks&lt;br /&gt;
:Number of ticks for Timer. 0 or -1 for infinite loop.&lt;br /&gt;
&lt;br /&gt;
NSIS Function&lt;br /&gt;
:Address of NSIS function to call from plug-in. Use GetFunctionAddress to obtain this address of your function.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Stop Function ===&lt;br /&gt;
&lt;br /&gt;
Stops the timer immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function TryMe&lt;br /&gt;
  MessageBox MB_OK &amp;quot;TryMe&amp;quot;&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExample&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 2345 8 $2 ; Timer ticks every 2345 milliseconds, totally 8 times calls TryMe&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExampleInfiniteLoop&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 1234 -1 $2 ; Timer ticks every 1234 milliseconds, it calls function TryMe in infinite loop until ThreadTimer::Stop is called&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function .onGUIEnd&lt;br /&gt;
	ThreadTimer::Stop&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
There are several important facts to know about this plug-in:&lt;br /&gt;
* Timer runs in separate thread. If you forget to call ThreadTimer::Stop it will still run however your NSIS installer exists! This may cause (and often causes) crash!&lt;br /&gt;
* There is no error handling in this version, be careful with parameters!&lt;br /&gt;
* If you need to execute some function periodically in whole life of installer (on each page, also while installing files, ...) use ThreadTimer::Start in your .onInit function.&lt;br /&gt;
* It is nice habit to call ThreadTimer::Stop in your .onGUIEnd function.&lt;br /&gt;
* Plug-in does not use SetTimer and KillTimer WinAPI functions. Instead it creates a new thread and uses Sleep() to wait for desired Interval. There might be a little inaccuracy in time periods!&lt;br /&gt;
&lt;br /&gt;
== Versions History ==&lt;br /&gt;
;1.1.1 (July 2012)(by jiake)&lt;br /&gt;
* Update it so that you can remove /NOUNLOAD switch when using in NSIS&lt;br /&gt;
* Remove unused code from source&lt;br /&gt;
* Size 3.5kB(ANSI)/3kB(Unicode)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.1 (October 2011)&lt;br /&gt;
* Second version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Pure C code - removed all dependencies on CRT but included TinyC lib&lt;br /&gt;
* Removed decorated names of calls&lt;br /&gt;
* Size ~4kB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.0 (2011)&lt;br /&gt;
* First version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Removed dependency on MS VCR 9.0 runtime (Bigger size of dll).&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
*Version 1.0 by [[User:Slappy|Slappy]] Graphical installers: [http://www.unsigned-softworks.sk www.unsigned-softworks.sk]&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22159</id>
		<title>ThreadTimer plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=ThreadTimer_plug-in&amp;diff=22159"/>
		<updated>2012-07-13T17:27:24Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Versions History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Download Link ==&lt;br /&gt;
v1.1 (updated October 2011) by [[User:Slappy|Slappy]] &amp;lt;attach&amp;gt;ThreadTimer.zip&amp;lt;/attach&amp;gt; [http://forums.winamp.com/showthread.php?t=331275 Forum thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
ThreadTimer plug-in allows you to create simple Timer which runs in a &#039;&#039;&#039;separate thread&#039;&#039;&#039;.&lt;br /&gt;
It is available since Start until Stop, it ticks in desired interval and calls NSIS function.&lt;br /&gt;
It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page.&lt;br /&gt;
&lt;br /&gt;
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below)&lt;br /&gt;
&lt;br /&gt;
[[File:SkinnedControls-Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
See simple example below for fast start.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Start Function ===&lt;br /&gt;
&lt;br /&gt;
Initializes Timer and starts it immediately.&lt;br /&gt;
NSIS Function will be called first time Interval milliseconds after calling Start.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
&lt;br /&gt;
/NOUNLOAD&lt;br /&gt;
: This must be defined! Plug-in will crash without this parameter!&lt;br /&gt;
&lt;br /&gt;
Interval&lt;br /&gt;
:Interval for timer [milliseconds]. Timer ticks each Interval and calls NSIS Function.&lt;br /&gt;
&lt;br /&gt;
Ticks&lt;br /&gt;
:Number of ticks for Timer. 0 or -1 for infinite loop.&lt;br /&gt;
&lt;br /&gt;
NSIS Function&lt;br /&gt;
:Address of NSIS function to call from plug-in. Use GetFunctionAddress to obtain this address of your function.&lt;br /&gt;
&lt;br /&gt;
=== ThreadTimer::Stop Function ===&lt;br /&gt;
&lt;br /&gt;
Stops the timer immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function TryMe&lt;br /&gt;
  MessageBox MB_OK &amp;quot;TryMe&amp;quot;&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExample&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 2345 8 $2 ; Timer ticks every 2345 milliseconds, totally 8 times calls TryMe&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function TimerExampleInfiniteLoop&lt;br /&gt;
  GetFunctionAddress $2 TryMe&lt;br /&gt;
  ThreadTimer::Start /NOUNLOAD 1234 -1 $2 ; Timer ticks every 1234 milliseconds, it calls function TryMe in infinite loop until ThreadTimer::Stop is called&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Function .onGUIEnd&lt;br /&gt;
	ThreadTimer::Stop&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
There are several important facts to know about this plug-in:&lt;br /&gt;
* Timer runs in separate thread. If you forget to call ThreadTimer::Stop it will still run however your NSIS installer exists! This may cause (and often causes) crash!&lt;br /&gt;
* There is no error handling in this version, be careful with parameters!&lt;br /&gt;
* If you need to execute some function periodically in whole life of installer (on each page, also while installing files, ...) use ThreadTimer::Start in your .onInit function.&lt;br /&gt;
* It is nice habit to call ThreadTimer::Stop in your .onGUIEnd function.&lt;br /&gt;
* Plug-in does not use SetTimer and KillTimer WinAPI functions. Instead it creates a new thread and uses Sleep() to wait for desired Interval. There might be a little inaccuracy in time periods!&lt;br /&gt;
&lt;br /&gt;
== Versions History ==&lt;br /&gt;
;1.1.1 (July 2012)(by jiake)&lt;br /&gt;
* Update it so that you can remove /NOUNLOAD switch when using in NSIS&lt;br /&gt;
* Remove unused code from source&lt;br /&gt;
* Size 3.5kB(ANSI)/3kB(Unicode)&lt;br /&gt;
&lt;br /&gt;
;1.1 (October 2011)&lt;br /&gt;
* Second version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Pure C code - removed all dependencies on CRT but included TinyC lib&lt;br /&gt;
* Removed decorated names of calls&lt;br /&gt;
* Size ~4kB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;1.0 (2011)&lt;br /&gt;
* First version&lt;br /&gt;
* Unicode &amp;amp; ANSI builds are available&lt;br /&gt;
* Sources included&lt;br /&gt;
* Removed dependency on MS VCR 9.0 runtime (Bigger size of dll).&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
*Version 1.0 by [[User:Slappy|Slappy]] Graphical installers: [http://www.unsigned-softworks.sk www.unsigned-softworks.sk]&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22156</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22156"/>
		<updated>2012-07-12T16:56:11Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here. Any question please email jiake(at)vip.qq.com.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A variable to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} (0) A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  (1) A limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} (2) An administrator account.&lt;br /&gt;
;     error                  An error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22126</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22126"/>
		<updated>2012-06-30T10:17:50Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here. Any question please email jiake(at)vip.qq.com.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A varible to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} (0) A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  (1) A limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} (2) An administrator account.&lt;br /&gt;
;     error                  An error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22067</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22067"/>
		<updated>2012-06-25T05:23:26Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above, by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here. Any question please email jiake(at)vip.qq.com.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A varible to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} (0) A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  (1) A limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} (2) An administrator account.&lt;br /&gt;
;     error                  A error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22066</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22066"/>
		<updated>2012-06-25T05:21:26Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above, by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above, by jiake) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A varible to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} (0) A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  (1) A limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} (2) An administrator account.&lt;br /&gt;
;     error                  A error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22065</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22065"/>
		<updated>2012-06-25T05:17:54Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above, by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above, by jiake) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; ${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
; STRING_OR_VAR_USERNAME:&lt;br /&gt;
;   A valid username.&lt;br /&gt;
; VAR_USER_LEVEL_OUT:&lt;br /&gt;
;   A varible to store the result, it can be:&lt;br /&gt;
;     ${USER_PRIV_GUEST} A guest account.&lt;br /&gt;
;     ${USER_PRIV_USER}  A Limited account.&lt;br /&gt;
;     ${USER_PRIV_ADMIN} An administrator account.&lt;br /&gt;
;     error              A error ocurred while calling.&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22064</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22064"/>
		<updated>2012-06-25T05:16:27Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macro 3 (Windows 2k or above, by jiake) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above, by jiake) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
STRING_OR_VAR_USERNAME:&lt;br /&gt;
  A valid username.&lt;br /&gt;
VAR_USER_LEVEL_OUT&lt;br /&gt;
  A varible to store the result, it can be:&lt;br /&gt;
    ${USER_PRIV_GUEST} A guest account.&lt;br /&gt;
    ${USER_PRIV_USER}  A Limited account.&lt;br /&gt;
    ${USER_PRIV_ADMIN} An administrator account.&lt;br /&gt;
    error              A error ocurred while calling.&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22063</id>
		<title>Check if the current user is an Administrator</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_if_the_current_user_is_an_Administrator&amp;diff=22063"/>
		<updated>2012-06-25T05:14:56Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Macros */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|CancerFace}}&lt;br /&gt;
&lt;br /&gt;
NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
I wanted to have the option of checking if a user belongs to the adminisrator&#039;s group without using a special plugin. This can be achieved using API calls with the System plugin.&lt;br /&gt;
&lt;br /&gt;
There are 3 alternative implementations (2 macros and 1 function).&lt;br /&gt;
&lt;br /&gt;
== Macros ==&lt;br /&gt;
The first macro works only in Windows 2000, XP and 2003 while the second one also works in NT&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Use the following code in your NSIS installer to find out if the user invoking it belongs to the administrator&#039;s group:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro IsUserAdmin $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&lt;br /&gt;
; $0 = -1 if there was an error (only for the 1st Macro)&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 1 (2k/XP/2k3)===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
   StrCpy ${RESULT} 0&lt;br /&gt;
   System::Call &#039;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&#039;&lt;br /&gt;
   System::Call &#039;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0, \&lt;br /&gt;
   i 0,*i .R0)i.r5&#039;&lt;br /&gt;
   System::Free $0&lt;br /&gt;
   System::Call &#039;advapi32::CheckTokenMembership(i n,i R0,*i .R1)i.r5&#039;&lt;br /&gt;
   StrCmp $5 0 ${Index}_Error&lt;br /&gt;
   StrCpy ${RESULT} $R1&lt;br /&gt;
   Goto ${Index}_End&lt;br /&gt;
 ${Index}_Error:&lt;br /&gt;
   StrCpy ${RESULT} -1&lt;br /&gt;
 ${Index}_End:&lt;br /&gt;
   System::Call &#039;advapi32::FreeSid(i R0)i.r5&#039;&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 2 (NT/2k/XP/2k3) - doesn&#039;t work! ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define TOKEN_READ   0x00020008&lt;br /&gt;
!define TokenGroups  2&lt;br /&gt;
&lt;br /&gt;
!macro IsUserAdmin RESULT&lt;br /&gt;
 !define Index &amp;quot;Line${__LINE__}&amp;quot;&lt;br /&gt;
 StrCpy ${RESULT} 0&lt;br /&gt;
&lt;br /&gt;
 # Construct the SID for the Admin group - (S-1-5-32-544 for administrators) put in $R4&lt;br /&gt;
  System::Call &amp;quot;*(&amp;amp;i1 0,&amp;amp;i4 0,&amp;amp;i1 5)i.r0&amp;quot;&lt;br /&gt;
  System::Call  &amp;quot;advapi32::AllocateAndInitializeSid(i r0,i 2,i 32,i 544,i 0,i 0,i 0,i 0,i 0,\&lt;br /&gt;
  i 0,*i .R4)i.r5&amp;quot;&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
 # Get a psuedo-handle of the current process and place it on R0&lt;br /&gt;
  System::Call &#039;kernel32::GetCurrentProcess()i.R0&#039;&lt;br /&gt;
&lt;br /&gt;
 # Open the Token from the psuedo process and place the handle on R1&lt;br /&gt;
  System::Call &#039;advapi32::OpenProcessToken(i R0,i ${TOKEN_READ},*i .R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Get info from the token and place it in $R2 (the size goes to $R3)&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},*i .R2,i 0,*i .R3)i.R9&#039;&lt;br /&gt;
  System::Alloc $R3&lt;br /&gt;
   Pop $R2&lt;br /&gt;
  System::Call &#039;advapi32::GetTokenInformation(i R1,i ${TokenGroups},i R2,i $R3,*i .R3)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # Check how many TOKEN_GROUPS elements are in $R2 (place the number in $R5)&lt;br /&gt;
  System::Call &#039;*$R2(i.R5,i.R6)&#039;&lt;br /&gt;
&lt;br /&gt;
 # Compare the SID structures&lt;br /&gt;
  StrCpy $1 0&lt;br /&gt;
	&lt;br /&gt;
 ${Index}_Start:&lt;br /&gt;
  StrCmp $1 $R5 ${Index}_Stop&lt;br /&gt;
  System::Call &#039;advapi32::EqualSid(i R4,i R6)i.R9&#039;&lt;br /&gt;
  StrCmp $R9 &amp;quot;&amp;quot; ${Index}_Increment&lt;br /&gt;
  StrCmp $R9 0 +1 +3&lt;br /&gt;
  StrCpy ${RESULT} 0&lt;br /&gt;
   Goto ${Index}_Increment&lt;br /&gt;
  StrCpy ${RESULT} 1&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
   Goto ${Index}_Stop&lt;br /&gt;
 ${Index}_Increment:&lt;br /&gt;
  System::Call &#039;advapi32::GetLengthSid(i R6)i.R9&#039;&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R6)i.R8&#039;&lt;br /&gt;
  IntOp $R6 $R6 + $R9&lt;br /&gt;
  IntOp $1 $1 + 1&lt;br /&gt;
  Goto ${Index}_Start&lt;br /&gt;
&lt;br /&gt;
 ${Index}_Stop:&lt;br /&gt;
 # Close the token handle&lt;br /&gt;
  System::Call &#039;kernel32::CloseHandle(i R1)i.R9&#039;&lt;br /&gt;
&lt;br /&gt;
 # cleanup&lt;br /&gt;
  System::Call &#039;advapi32::FreeSid(i R4)i.r5&#039;&lt;br /&gt;
  System::Free $R2&lt;br /&gt;
  System::Free 0&lt;br /&gt;
&lt;br /&gt;
 !undef Index&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Macro 3 (Windows 2k or above, by jiake) ===&lt;br /&gt;
Today an NSIS user in our QQ group ask for this question again: how to determine whether the current user is an administrator user. I found that a Windows API can get the information of the specified user name, it&#039;s more easier than the above ways, I write it and so add it here.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define USER_PRIV_GUEST 0&lt;br /&gt;
!define USER_PRIV_USER  1&lt;br /&gt;
!define USER_PRIV_ADMIN 2&lt;br /&gt;
&lt;br /&gt;
!include &amp;quot;Util.nsh&amp;quot;&lt;br /&gt;
!define GetUserLevel &amp;quot;!insertmacro Call_GetUserLevel&amp;quot;&lt;br /&gt;
!macro Call_GetUserLevel _level _username&lt;br /&gt;
    !verbose push&lt;br /&gt;
    !verbose 3&lt;br /&gt;
    Push ${_username}&lt;br /&gt;
    ${CallArtificialFunction} Func_GetUserLevel&lt;br /&gt;
    Pop ${_level}&lt;br /&gt;
    !verbose pop&lt;br /&gt;
!macroend&lt;br /&gt;
!macro Func_GetUserLevel&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Push $R1&lt;br /&gt;
    System::Call &amp;quot;*(i)i.R1&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetUserGetInfo(in,wR0,i1,iR1)i.R0&amp;quot;&lt;br /&gt;
    IntCmp $R0 0 +3&lt;br /&gt;
    Push error&lt;br /&gt;
    Goto lbl_end&lt;br /&gt;
    System::Call &amp;quot;*$R1(i.R0)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;*$R0(w,w,i,i.s)&amp;quot;&lt;br /&gt;
    System::Call &amp;quot;netapi32::NetApiBufferFree(iR0)&amp;quot;&lt;br /&gt;
lbl_end:&lt;br /&gt;
    System::Free $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Pop $R0&lt;br /&gt;
!macroend&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
${GetUserLevel} VAR_USER_LEVEL_OUT STRING_OR_VAR_USERNAME&lt;br /&gt;
STRING_OR_VAR_USERNAME:&lt;br /&gt;
  A valid username.&lt;br /&gt;
VAR_USER_LEVEL_OUT&lt;br /&gt;
  A varible. It can be:&lt;br /&gt;
    ${USER_PRIV_GUEST} A guest account.&lt;br /&gt;
    ${USER_PRIV_USER}  A Limited account.&lt;br /&gt;
    ${USER_PRIV_ADMIN} An administrator account.&lt;br /&gt;
    error              A error ocurred while calling.&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
ReadEnvStr $R0 UserName&lt;br /&gt;
${GetUserLevel} $0 $R0&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user $R0&#039;s level is $0.&amp;quot;&lt;br /&gt;
${GetUserLevel} $0 Administrator&lt;br /&gt;
MessageBox MB_OK &amp;quot;The user Administrator&#039;s level is $0.&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function (by Afrow UK) ==&lt;br /&gt;
Based on [http://vcfaq.mvps.org/sdk/21.htm this code]&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #f00&amp;quot;&amp;gt;Note: After testing in the field, this function does not always work. Use the other function or use the included NSIS UserInfo plug-in (UserInfo::GetAccountType).&amp;lt;/span&amp;gt;&amp;lt;highlight-nsis&amp;gt;!define SC_MANAGER_LOCK 8&lt;br /&gt;
!define ERROR_SERVICE_DATABASE_LOCKED 1055&lt;br /&gt;
&lt;br /&gt;
Function IsUserAdmin&lt;br /&gt;
Push $R0&lt;br /&gt;
Push $R1&lt;br /&gt;
Push $R2&lt;br /&gt;
&lt;br /&gt;
  StrCpy $R0 0&lt;br /&gt;
&lt;br /&gt;
  System::Call `advapi32::OpenSCManager(i 0, i 0, i ${SC_MANAGER_LOCK}) i.R1`&lt;br /&gt;
  ${If} $R1 != 0&lt;br /&gt;
    System::Call `advapi32::LockServiceDatabase(i R1) i.R2`&lt;br /&gt;
    ${If} $R2 != 0&lt;br /&gt;
      System::Call `advapi32::UnlockServiceDatabase(i R2)`&lt;br /&gt;
      StrCpy $R0 1&lt;br /&gt;
    ${Else}&lt;br /&gt;
      System::Call `kernel32::GetLastError() i.R2`&lt;br /&gt;
      ${If} $R2 == ${ERROR_SERVICE_DATABASE_LOCKED}&lt;br /&gt;
        StrCpy $R0 1&lt;br /&gt;
      ${EndIf}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call `advapi32::CloseServiceHandle(i R1)`&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
Pop $R2&lt;br /&gt;
Pop $R1&lt;br /&gt;
Exch $R0&lt;br /&gt;
FunctionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;Call IsUserAdmin&lt;br /&gt;
Pop $0&lt;br /&gt;
; $0 = 1 if the user belongs to the administrator&#039;s group&lt;br /&gt;
; $0 = 0 if not&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources and Links ==&lt;br /&gt;
* NSIS forum [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=253904 thread]&lt;br /&gt;
* [http://nsis.sourceforge.net/XtInfoPlugin_plug-in XtInfo Plugin]&lt;br /&gt;
&lt;br /&gt;
API Functions used:&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp AllocateAndInitializeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentprocess.asp GetCurrentProcess]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/openprocesstoken.asp OpenProcessToken]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/gettokeninformation.asp GetTokenInformation]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/equalsid.asp EqualSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/freesid.asp FreeSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/getlengthsid.asp GetLengthSid]&lt;br /&gt;
* [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/closehandle.asp CloseHandle]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19995</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19995"/>
		<updated>2011-05-15T01:58:40Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for common windows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can find the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i32,i32,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 32.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i32,i32,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19870</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19870"/>
		<updated>2011-04-21T08:13:36Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for common windows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can find the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19869</id>
		<title>File:ListView.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19869"/>
		<updated>2011-04-21T08:06:32Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ListView.zip&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19694</id>
		<title>File:ListView.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19694"/>
		<updated>2011-03-25T15:35:43Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ListView.zip&amp;amp;quot;: Update scripts and examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19523</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19523"/>
		<updated>2011-02-28T10:20:34Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for common windows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can find the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19522</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19522"/>
		<updated>2011-02-28T10:17:53Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for common windows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19521</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19521"/>
		<updated>2011-02-28T10:09:15Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for common windows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19519</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19519"/>
		<updated>2011-02-28T04:22:58Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd iCol cx szText&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd iItem szText&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd iItem iSubItem szText&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19506</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19506"/>
		<updated>2011-02-25T20:15:12Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles of a control. Note, the following text come from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles of a control. It may not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19505</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19505"/>
		<updated>2011-02-25T20:11:43Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles from a control. Note, from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx. You can the function introduction of each message and their parameters on MSDN.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19504</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19504"/>
		<updated>2011-02-25T20:08:08Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles from a control. Note, from MSDN: For some styles in certain controls (For example, add the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style to an edit control will not make it read-only), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19503</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19503"/>
		<updated>2011-02-25T20:05:38Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window styles from a control. Note, from MSDN: For some styles in certain controls (the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window styles from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox String&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from the ComboBox control. Note: If the string you specified doesn&#039;t exist in the ComboBox, the first string that contains what you specified will be deleted. For example: there are 4 items in the ComboBox: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the count of strings in the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control. The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this header. Note: If the string you specified is not exist in the ListBox, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value). The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the ListBox. This macro is redefined like the above one, it doesn&#039;t return any value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19502</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19502"/>
		<updated>2011-02-25T19:57:31Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. Note, from MSDN: For some styles in certain controls (the [http://msdn.microsoft.com/en-us/library/bb775464.aspx ES_READONLY] style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the total number of strings of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as [http://msdn.microsoft.com/en-us/library/bb774894.aspx LVM_DELETECOLUMN] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as [http://msdn.microsoft.com/en-us/library/bb774895.aspx LVM_DELETEITEM] message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send [http://msdn.microsoft.com/en-us/library/bb761178.aspx LVM_SETIMAGELIST] message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the [http://msdn.microsoft.com/en-us/library/bb761165.aspx LVM_SETEXTENDEDLISTVIEWSTYLE] message to set the [http://msdn.microsoft.com/en-us/library/bb774732.aspx LVS_EX_CHECKBOXES] extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19501</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19501"/>
		<updated>2011-02-25T19:50:33Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS Chinese forum &amp;quot;www.dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me later. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Additional macros for ListBox and ComboBox:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. Note, from MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the total number of strings of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string of the ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string of the ListBox control.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings of the ListBox control (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;New macros for ListView control:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to the ListView control. To delete a column from the ListView control, just send the LVM_DELETECOLUMN message: SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column of the ListView control. Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to the ListView control. To delete an item from the ListView control, just send the LVM_DELETECOLUMN message: SendMessage hListview ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item of the ListView control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem of the ListView control. To retrieve an item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (videlicet, inserts a new subitem) of the ListView control. To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the associated bitmap or icon&#039; of an item in the ListView control. Before using this you must create an ImageList first that contains one or more bitmaps or icons, and send LVM_SETIMAGELIST message to associate the ImageList with the ListView control. Then you should pass the zero-based index of the image in the ImageList to &amp;quot;iImage&amp;quot;. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the check state of an item in a listview control with checkboxes extended style. Result may be 1, which represents the item is checked, or 0, represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or unchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
The original author of this header adds more controls support and more macros in this header, therefore it is renamed to &amp;quot;CommCtrl.nsh&amp;quot;. As more controls support will be added in future, and this page will also be updated. If you have any suggestions you may contact with gfm688: 395177116#qq.com, or me: 550771955#qq.com.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19492</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19492"/>
		<updated>2011-02-25T15:20:51Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macros in this header:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a ListBox control.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a ListBox control (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview control (report view). To delete a column from a listview control, just sending the LVM_DELETECOLUMN message - SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column from a listview control (report view). Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview control (report view). To delete an item from a listview control, just sending the LVM_DELETECOLUMN message - SendMessage listview_HWND ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item from a listview control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem from an item of listview control (report view). To retrieve the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (inserts a new subitem) to an item of listview control (report view). To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using this you must create an ImageList first that contains one or more bitmaps or icons. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the state of an item in a listview control with checkboxes extended style. Result may be 1, represents the item is checked, or 0 represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or umchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19491</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19491"/>
		<updated>2011-02-25T15:20:04Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me. I add some new macros, include some for ComboBox and ListBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macros in this header:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a ComboBox control (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a ComboBox control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a ListBox control.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox #redefined in header&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a ListBox control (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview control (report view). To delete a column from a listview control, just sending the LVM_DELETECOLUMN message - SendMessage hListview ${LVM_DELETECOLUMN} iCol 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column from a listview control (report view). Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview control (report view). To delete an item from a listview control, just sending the LVM_DELETECOLUMN message - SendMessage listview_HWND ${LVM_DELETEITEM} iItem 0.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item from a listview control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem from an item of listview control (report view). To retrieve the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (inserts a new subitem) to an item of listview control (report view). To set the item&#039;s text, pass iSubItem with 0 (zero).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using this you must create an ImageList first that contains one or more bitmaps or icons. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the state of an item in a listview control with checkboxes extended style. Result may be 1, represents the item is checked, or 0 represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or umchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 (one) to check it or 0 (zero) to uncheck it. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
To set the text color, background color, set column width, etc. You can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn. All messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19490</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19490"/>
		<updated>2011-02-25T15:09:59Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macros in this header:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview control (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage hListview ${LVM_DELETECOLUMN} iCol 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column from a listview control (report view). Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview control (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} iItem 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item from a listview control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem from an item of listview control (report view). To retrieve the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (inserts a new subitem) to an item of listview control (report view). To set the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using this you must create an ImageList first that contains one or more bitmaps or icons. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the state of an item in a listview control with checkboxes extended style. Result may be 1, represents the item is checked, or 0 represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or umchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 to check it or 0 to uncheck it. Before using thsi you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, set column width, etc. you can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn.&lt;br /&gt;
&lt;br /&gt;
See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(ir0,i9,i${IMAGE_ICON},i16,i16,i${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19489</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19489"/>
		<updated>2011-02-25T15:06:53Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macros in this header:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview control (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage hListview ${LVM_DELETECOLUMN} iCol 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column from a listview control (report view). Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview control (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} iItem 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item from a listview control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem from an item of listview control (report view). To retrieve the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (inserts a new subitem) to an item of listview control (report view). To set the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using this you must create an ImageList first that contains one or more bitmaps or icons. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the state of an item in a listview control with checkboxes extended style. Result may be 1, represents the item is checked, or 0 represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or umchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 to check it or 0 to uncheck it. Before using thsi you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, set column width, etc. you can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn.&lt;br /&gt;
&lt;br /&gt;
See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;CommCtrl.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
&lt;br /&gt;
    StrCmp $0 error 0 +2&lt;br /&gt;
    Abort&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetItemText} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetItemText} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED}).R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19488</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19488"/>
		<updated>2011-02-25T15:04:13Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See this attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macros in this header:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} hWnd Styles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} hWnd ExStyles&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} hComboBox string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} hComboBox&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} hComboBox outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} hListBox String # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} hListBox # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} hListview iCol cx szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview control (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage hListview ${LVM_DELETECOLUMN} iCol 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteColumn} hListview iCol&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes a column from a listview control (report view). Same as LVM_DELETECOLUMN message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} hListview iItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview control (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} iItem 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_DeleteItem} hListview iItem&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes an item from a listview control (report view). Same as LVM_DELETEITEM message.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} hListview iItem iSubItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item or its subitem from an item of listview control (report view). To retrieve the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemText} hListview iItem iSubItem szText&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the text of an item or its subitem (inserts a new subitem) to an item of listview control (report view). To set the item&#039;s text, pass iSubItem with zero.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemImage} hListview iItem iImage&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using this you must create an ImageList first that contains one or more bitmaps or icons. See examples in the above attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetCheckState} hListview iItem outVar&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the state of an item in a listview control with checkboxes extended style. Result may be 1, represents the item is checked, or 0 represents unchecked. Before using this you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetCheckState} hListview iItem State&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks or umchecks an item in a listview control with checkboxes extended style. Pass &amp;quot;State&amp;quot; with 1 to check it or 0 to uncheck it. Before using thsi you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, set column width, etc. you can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn.&lt;br /&gt;
&lt;br /&gt;
See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961.aspx.&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED}).R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19487</id>
		<title>File:ListView.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=19487"/>
		<updated>2011-02-25T14:42:07Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ListView.zip&amp;amp;quot;: Change some macro names, add new macros and update example.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19320</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=19320"/>
		<updated>2011-01-27T07:43:37Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See the attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macro commands in this file:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} combo_HWND string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} combo_HWND&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} listbox_HWND string # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} listbox_HWND # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} listview_HWND col_idx col_width text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETECOLUMN} col_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} listview_HWND item_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} item_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetSubItem} listview_HWND item_idx subitem_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new subitem to an item of listview (report view).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemIcon} listview_HWND item_idx icon_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using you must first create an image list that contain the handle of one or more bitmap or icon. See examples in the attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemChecked} listview_HWND item_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks an item of a listview with checkboxes extended style. Before using you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style take effect.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} listview_HWND item_idx subitem_idx output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item of a listview. To retrieve the item text, set subitem_idx to zero.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, delete column, delete item, set column width, etc. you can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn.&lt;br /&gt;
&lt;br /&gt;
See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961&lt;br /&gt;
&lt;br /&gt;
[[Category:Headers]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED}).R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Check_open_ports&amp;diff=19039</id>
		<title>Check open ports</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Check_open_ports&amp;diff=19039"/>
		<updated>2010-11-05T08:23:55Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below is a function allowing you to test for open UDP and TCP ports on the local computer. Use this to check if the user selected port is free, if Apache can run with the default configuration or if your favorite port hasn&#039;t been stolen by another.&lt;br /&gt;
&lt;br /&gt;
This code uses iphlpapi.dll which is only available on Windows 98 and above and NT 4.0 SP4 and above.&lt;br /&gt;
== Usage ==&lt;br /&gt;
First, save Ports.nsh from the code snippet at the end of this page to Ports.nsh. Next, include it into your script.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;!include &amp;quot;Ports.nsh&amp;quot;&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Now, to check for open TCP ports, use the following.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;${Unless} ${TCPPortOpen} 80&lt;br /&gt;
  MessageBox MB_OK &amp;quot;httpd running&amp;quot;&lt;br /&gt;
${EndUnless}&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
To check for open UDP ports, only a slight modification is required.&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;${If} ${UDPPortOpen} 1337&lt;br /&gt;
  MessageBox MB_OK &amp;quot;leet port open :)&amp;quot;&lt;br /&gt;
${EndIf}&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Ports.nsh ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;# Usage:&lt;br /&gt;
#   Push &amp;quot;Tcp&amp;quot; or &amp;quot;Udp&amp;quot;&lt;br /&gt;
#   Push &amp;quot;port_number&amp;quot;&lt;br /&gt;
#   Call IsPortOpen&lt;br /&gt;
#   Pop $0 ; &amp;quot;open&amp;quot; or &amp;quot;closed&amp;quot; or anything else for error&lt;br /&gt;
#&lt;br /&gt;
# Or with the LogicLib&lt;br /&gt;
#   ${If} ${TCPPortOpen} 80&lt;br /&gt;
#   ${EndIf}&lt;br /&gt;
#   ${If} ${UDPPortOpen} 137&lt;br /&gt;
#   ${EndIf}&lt;br /&gt;
#&lt;br /&gt;
Function IsPortOpen&lt;br /&gt;
&lt;br /&gt;
  Exch $R0 # port to check&lt;br /&gt;
  Exch&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Push $0&lt;br /&gt;
  Push $1&lt;br /&gt;
  Push $2&lt;br /&gt;
&lt;br /&gt;
  System::Call &#039;iphlpapi::Get$R1Table(*i.r0, *i .r1, i 1) i .r2&#039;&lt;br /&gt;
  ${If} $2 != 122 # ERROR_INSUFFICIENT_BUFFER&lt;br /&gt;
    StrCpy $R0 &amp;quot;&amp;quot;&lt;br /&gt;
    Pop $2&lt;br /&gt;
    Pop $1&lt;br /&gt;
    Pop $0&lt;br /&gt;
    Exch $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Return&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
  System::Alloc $1&lt;br /&gt;
  Pop $0&lt;br /&gt;
&lt;br /&gt;
  System::Call &#039;iphlpapi::Get$R1Table(ir0, *i r1, i 1) i .r2&#039;&lt;br /&gt;
  ${If} $2 != 0 # NO_ERROR&lt;br /&gt;
    System::Free $0&lt;br /&gt;
    StrCpy $R0 &amp;quot;&amp;quot;&lt;br /&gt;
    Pop $2&lt;br /&gt;
    Pop $1&lt;br /&gt;
    Pop $0&lt;br /&gt;
    Exch $R1&lt;br /&gt;
    Exch&lt;br /&gt;
    Exch $R0&lt;br /&gt;
    Return&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
  Push $3&lt;br /&gt;
  Push $4&lt;br /&gt;
  Push $5&lt;br /&gt;
&lt;br /&gt;
  System::Call *$0(i.r2)&lt;br /&gt;
  IntOp $2 $2 - 1&lt;br /&gt;
  ${For} $3 0 $2&lt;br /&gt;
    IntOp $4 $0 + 4  # skip dwNumEntries&lt;br /&gt;
    ${If} $R1 == &amp;quot;Tcp&amp;quot;&lt;br /&gt;
      IntOp $5 $3 * 20 # sizeof(MIB_TCPROW)&lt;br /&gt;
      IntOp $4 $4 + $5 # skip to entry&lt;br /&gt;
      System::Call *$4(i,i,i.r4,i,i)&lt;br /&gt;
    ${Else}&lt;br /&gt;
      IntOp $5 $3 * 8 # sizeof(MIB_UDPROW)&lt;br /&gt;
      IntOp $4 $4 + $5 # skip to entry&lt;br /&gt;
      System::Call *$4(i,i.r4)&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
    System::Call ws2_32::ntohs(ir4)i.r4&lt;br /&gt;
&lt;br /&gt;
    ${If} $4 = $R0&lt;br /&gt;
      StrCpy $R0 &amp;quot;open&amp;quot;&lt;br /&gt;
      ${Break}&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
  ${Next}&lt;br /&gt;
&lt;br /&gt;
  ${If} $R0 != &amp;quot;open&amp;quot;&lt;br /&gt;
    StrCpy $R0 &amp;quot;closed&amp;quot;&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
  System::Free $0&lt;br /&gt;
&lt;br /&gt;
  Pop $5&lt;br /&gt;
  Pop $4&lt;br /&gt;
  Pop $3&lt;br /&gt;
  Pop $2&lt;br /&gt;
  Pop $1&lt;br /&gt;
  Pop $0&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Exch&lt;br /&gt;
  Exch $R0&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
# LogicLib macros for IsPortOpen&lt;br /&gt;
&lt;br /&gt;
!include LogicLib.nsh&lt;br /&gt;
&lt;br /&gt;
!macro _PortOpen _a _b _t _f&lt;br /&gt;
  !insertmacro _LOGICLIB_TEMP&lt;br /&gt;
  Push `${_a}`&lt;br /&gt;
  Push `${_b}`&lt;br /&gt;
  Call IsPortOpen&lt;br /&gt;
  Pop $_LOGICLIB_TEMP&lt;br /&gt;
  !insertmacro _== $_LOGICLIB_TEMP &amp;quot;open&amp;quot; `${_t}` `${_f}`&lt;br /&gt;
!macroend&lt;br /&gt;
!define PortOpen `PortOpen`&lt;br /&gt;
&lt;br /&gt;
!macro _TCPPortOpen _a _b _t _f&lt;br /&gt;
  !insertmacro _PortOpen Tcp `${_b}` `${_t}` `${_f}`&lt;br /&gt;
!macroend&lt;br /&gt;
!define TCPPortOpen `&amp;quot;&amp;quot; TCPPortOpen`&lt;br /&gt;
&lt;br /&gt;
!macro _UDPPortOpen _a _b _t _f&lt;br /&gt;
  !insertmacro _PortOpen Udp `${_b}` `${_t}` `${_f}`&lt;br /&gt;
!macroend&lt;br /&gt;
!define UDPPortOpen `&amp;quot;&amp;quot; UDPPortOpen`&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:System Plugin Examples]]&lt;br /&gt;
[[Category:Internet Functions]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18901</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18901"/>
		<updated>2010-09-13T11:26:45Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See the attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macro commands in this file:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} combo_HWND string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} combo_HWND&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} listbox_HWND string # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} listbox_HWND # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} listview_HWND col_idx col_width text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETECOLUMN} col_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} listview_HWND item_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} item_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetSubItem} listview_HWND item_idx subitem_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new subitem to an item of listview (report view).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemIcon} listview_HWND item_idx icon_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using you must first create an image list that contain the handle of one or more bitmap or icon. See examples in the attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemChecked} listview_HWND item_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks an item of a listview with checkboxes extended style. Before using you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style take effect.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} listview_HWND item_idx subitem_idx output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item of a listview. To retrieve the item text, set subitem_idx to zero.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, delete column, delete item, set column width, etc. you can also using SendMessage simplely.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETEITEM} 2 0, deletes the 2nd (zero-based) item.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_DELETECOLUMN} 4 0, deletes the 4th (zero-based) column.&lt;br /&gt;
&lt;br /&gt;
SendMessage $HWND ${LVM_SETBKCOLOR} 0 0xFF0000, sets the background color to red.&lt;br /&gt;
&lt;br /&gt;
Parameters of each message can be found on msdn.&lt;br /&gt;
&lt;br /&gt;
See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::LoadLibrary(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of small size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED}).R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width and height of each image is 16.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(i16,i16,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=18896</id>
		<title>File:ListView.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=18896"/>
		<updated>2010-09-10T04:49:13Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ListView.zip&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=18895</id>
		<title>File:ListView.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:ListView.zip&amp;diff=18895"/>
		<updated>2010-09-10T03:50:52Z</updated>

		<summary type="html">&lt;p&gt;550771955: uploaded a new version of &amp;amp;quot;File:ListView.zip&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18796</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18796"/>
		<updated>2010-08-02T02:20:42Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See the attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macro commands in this file:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), it may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} combo_HWND string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} combo_HWND&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} listbox_HWND string # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} listbox_HWND # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} listview_HWND col_idx col_width text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETECOLUMN} col_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} listview_HWND item_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} item_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetSubItem} listview_HWND item_idx subitem_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new subitem to an item of listview (report view).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemIcon} listview_HWND item_idx icon_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using you must first create an image list that contain the handle of one or more bitmap or icon. See examples in the attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemChecked} listview_HWND item_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks an item of a listview with checkboxes extended style. Before using you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style take effect.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} listview_HWND item_idx subitem_idx output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item of a listview. To retrieve the item text, set subitem_idx to zero.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, delete column, delete item, set column width, etc. you can also using SendMessage simplely. See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the recommended width and height of an icon.&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CXICON})i.r7&#039;&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CYICON})i.r8&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::GetModuleHandle(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of recommended size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width of each image is $7 and height is $8.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(ir7,ir8,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    ${NSD_FreeImage} $R1&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18795</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18795"/>
		<updated>2010-08-02T02:19:17Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Header file for creating Listview control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See the attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macro commands in this file:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. From MSDN: For some styles in certain controls (the ES_READONLY style in the edit control, for example), this may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} combo_HWND string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} combo_HWND&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} listbox_HWND string # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} listbox_HWND # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} listview_HWND col_idx col_width text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETECOLUMN} col_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} listview_HWND item_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} item_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetSubItem} listview_HWND item_idx subitem_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new subitem to an item of listview (report view).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemIcon} listview_HWND item_idx icon_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using you must first create an image list that contain the handle of one or more bitmap or icon. See examples in the attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemChecked} listview_HWND item_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks an item of a listview with checkboxes extended style. Before using you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style take effect.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} listview_HWND item_idx subitem_idx output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item of a listview. To retrieve the item text, set subitem_idx to zero.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, delete column, delete item, set column width, etc. you can also using SendMessage simplely. See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the recommended width and height of an icon.&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CXICON})i.r7&#039;&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CYICON})i.r8&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::GetModuleHandle(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of recommended size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width of each image is $7 and height is $8.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(ir7,ir8,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    ${NSD_FreeImage} $R1&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18783</id>
		<title>Header file for Listview</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Header_file_for_Listview&amp;diff=18783"/>
		<updated>2010-07-28T02:20:38Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Header file for creating Listview control ==&lt;br /&gt;
&lt;br /&gt;
In an NSIS forum &amp;quot;dreams8.com&amp;quot;, a member named &amp;quot;gfm688&amp;quot; writes a header file to create and handle a listview control with the report view. This header file is modified by me, I add some new macro commands, include some macro commands for ComboBox.&lt;br /&gt;
&lt;br /&gt;
See the attachment for details, 8 examples included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;attach&amp;gt;ListView.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All macro commands in this file:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more window style from a control. May not take effect in some cases as the ES_READONLY style of an edit control.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_RemoveExStyle} control_HWND style&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Removes one or more extended window style from a control. May not take effect in some cases for the above saying.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_DelString} combo_HWND string&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a combobox. Note: If the string you specified is not exist in a combo box, the first string that contains what you specified will be deleted. For example: there are 4 items in a combo box: First, Second, Seconds, Secondary. If you want to delete the string &amp;quot;sec&amp;quot;, the first one which contains &amp;quot;sec&amp;quot; from top - &amp;quot;Second&amp;quot; will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_Clear} combo_HWND&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a combobox (no return value).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetCount} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the number of strings from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_CB_GetSelection} combo_HWND output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the selected string from a combobox.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_DelString} listbox_HWND string # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes the specified string from a list box.&lt;br /&gt;
The macro command NSD_LB_DelString in nsDialogs.nsh always deletes the first string but not the specified one. I write a new macro to replace it, and undefine the original one in this file. Note: If the string you specified is not exist in a list box, the first string that contains what you specified will be deleted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LB_Clear} listbox_HWND # the redefined one&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Deletes all strings from a list box (no return value).&lt;br /&gt;
The macro command NSD_LB_Clear in nsDialogs.nsh needs two parameters, but the readme file of nsDialogs said the macro needs only one parameter, it is exactly the handle of the listbox. This macro is redefined as the above one, it doesn&#039;t return a value.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertColumn} listview_HWND col_idx col_width text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new column to a listview (report view). It is very easy to delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETECOLUMN} col_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_InsertItem} listview_HWND item_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new item to a listview (report view). To delete a column from a listview, just sending the LVM_DELETECOLUMN message to the listview - &amp;quot;SendMessage listview_HWND ${LVM_DELETEITEM} item_idx 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetSubItem} listview_HWND item_idx subitem_idx text&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Inserts a new subitem to an item of listview (report view).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemIcon} listview_HWND item_idx icon_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Sets the icon of an item of listview (report view). Before using you must first create an image list that contain the handle of one or more bitmap or icon. See examples in the attachment for details.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_SetItemChecked} listview_HWND item_idx&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Checks an item of a listview with checkboxes extended style. Before using you must send the LVM_SETEXTENDEDLISTVIEWSTYLE message to set the LVS_EX_CHECKBOXES extended style take effect.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;highlight-nsis&amp;gt;${NSD_LV_GetItemText} listview_HWND item_idx subitem_idx output_var&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Retrieves the text of an item of a listview. To retrieve the item text, set subitem_idx to zero.&lt;br /&gt;
&lt;br /&gt;
It is very easy to set the text color, background color, delete column, delete item, set column width, etc. you can also using SendMessage simplely. See all messages of listview control: http://msdn.microsoft.com/en-us/library/ff485961&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;A listview control created by nsDialogs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ; ${NSD_LV_InsertColumn} hwnd col_idx_0_based col_width col_text&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 100 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 2 100 &amp;quot;column 2&amp;quot;&lt;br /&gt;
    ; ${NSD_LV_InsertItem} hwnd item_idx_0_based item_text&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ; ${NSD_LV_SetSubItem} hwnd item_idx_0_based subitem_idx_1_based subitem_text&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 1 &#039;Subitem 0_1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 0 2 &#039;Subitem 0_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 1 2 &#039;Subitem 1_2&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ${NSD_LV_SetSubItem} $1 2 1 &#039;Subitem 2_1&#039;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section -Main&lt;br /&gt;
&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview1.png]]&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
/* Listview styles are defined in header file */&lt;br /&gt;
!include &amp;quot;MUI2.nsh&amp;quot;&lt;br /&gt;
!include &amp;quot;ListView.nsh&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Name &amp;quot;List View Example&amp;quot;&lt;br /&gt;
OutFile ListView.exe&lt;br /&gt;
 &lt;br /&gt;
Page custom CreatePage&lt;br /&gt;
!insertmacro MUI_LANGUAGE &amp;quot;English&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
Function CreatePage&lt;br /&gt;
 &lt;br /&gt;
    !insertmacro MUI_HEADER_TEXT &amp;quot;List view&amp;quot; &amp;quot;Using icon resource from system dll as image list&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    nsDialogs::Create 1018&lt;br /&gt;
    Pop $0&lt;br /&gt;
    ${If} $0 == error&lt;br /&gt;
        Abort&lt;br /&gt;
    ${EndIf}&lt;br /&gt;
 &lt;br /&gt;
    ${NSD_CreateListView} 0u 0u 300u 140u &amp;quot;Listview&amp;quot;&lt;br /&gt;
    Pop $1&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 0 200 &amp;quot;column 0&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertColumn} $1 1 200 &amp;quot;column 1&amp;quot;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 0 &#039;Item 0&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 1 &#039;Item 1&#039;&lt;br /&gt;
    ${NSD_LV_InsertItem} $1 2 &#039;Item 2&#039;&lt;br /&gt;
    ; Retrieve the recommended width and height of an icon.&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CXICON})i.r7&#039;&lt;br /&gt;
    System::Call &#039;user32::GetSystemMetrics(i${SM_CYICON})i.r8&#039;&lt;br /&gt;
    ; Retrieve the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;kernel32::GetModuleHandle(t&amp;quot;shell32.dll&amp;quot;)i.r0&#039;&lt;br /&gt;
    ; Load the 9th icon of recommended size in shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::LoadImage(i,t,i,i,i,i)i(r0,i9,${IMAGE_ICON},r7,r8,${LR_SHARED})i.R1&#039;&lt;br /&gt;
    ; Free the handle of shell32.dll.&lt;br /&gt;
    System::Call &#039;user32::FreeLibrary(ir0)&#039;&lt;br /&gt;
    ; Create an imagelist, width of each image is $7 and height is $8.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Create(ir7,ir8,i${ILC_MASK}|${ILC_COLOR32},i0,i0)i.R0&#039;&lt;br /&gt;
    ; Add icon to the imagelist by handle.&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_AddIcon(iR0,iR1)&#039;&lt;br /&gt;
    System::Call &#039;user32::DestroyIcon(iR1)&#039;&lt;br /&gt;
&lt;br /&gt;
    SendMessage $1 ${LVM_SETIMAGELIST} ${LVSIL_SMALL} $R0&lt;br /&gt;
    SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_FULLROWSELECT}&lt;br /&gt;
&lt;br /&gt;
    nsDialogs::Show&lt;br /&gt;
&lt;br /&gt;
    ; Destroy the image list&lt;br /&gt;
    ${NSD_FreeImage} $R1&lt;br /&gt;
    System::Call &#039;comctl32::ImageList_Destroy(iR0)&#039;&lt;br /&gt;
&lt;br /&gt;
FunctionEnd&lt;br /&gt;
 &lt;br /&gt;
Section -Main&lt;br /&gt;
 &lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
Compile the script and run, you will see a page like this:&lt;br /&gt;
[[File:Listview2.png]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=FontName_plug-in&amp;diff=18755</id>
		<title>FontName plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=FontName_plug-in&amp;diff=18755"/>
		<updated>2010-07-22T03:10:40Z</updated>

		<summary type="html">&lt;p&gt;550771955: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Vytautas}}&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* &amp;lt;attach&amp;gt;FontName-0.7.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
* [[File:Exe.gif]] [http://www.vytux.com/joomla/projects?func=startdown&amp;amp;id=1] (77 KB)&lt;br /&gt;
&lt;br /&gt;
[http://www.vytux.com Vytautas&#039; Website]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&#039;&#039;&#039;Version:&#039;&#039;&#039; 0.7.&lt;br /&gt;
&lt;br /&gt;
This plugin will retrieve the Display name from a TTF font file.  I wrote it to make it easier to register TTF fonts in windows.&lt;br /&gt;
&lt;br /&gt;
Note: This plugin could only get the English name of a font file. If the file contains more localised names, you may want to get the name of current language of your system. More information at: http://nsis.sourceforge.net/Get_localised_font_name.&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
This is an extract from the included readme showing an example of usage:&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
To use the plugin simply include the FontName.nsh file into your script then use one of the following macros:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro FontName &amp;quot;fontfile.ttf&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the stack contains the name of the Font or if the errors flag was set, the error message translated to your current language, or English if the translation is not yet available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!insertmacro FontNameVer&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This macro will push to the stack the translated version string for the FontName Plugin.&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
Please note that the font file MUST exist for the plugin to work, so you should check that before calling the plugin. For a more detailed example of the plugin&#039;s usage check out the [[Register Fonts]] and [[Advanced Font Installation]] pages created by me.&lt;br /&gt;
&lt;br /&gt;
Un.installation part for this plug in generate error nd wont work but other things work correct.&lt;br /&gt;
&lt;br /&gt;
== Version History ==&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2005-08-03]&#039;&#039;&#039;&lt;br /&gt;
Added more translations. The installer now also installs the latest font registration header files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2004-02-19]&#039;&#039;&#039;&lt;br /&gt;
Added french translation to distribution. Optimized source code somewhat.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2004-02-10]&#039;&#039;&#039;&lt;br /&gt;
Used a different compiler, reduced the plugin&#039;s file size from 32kb to just 9kb.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2004-01-29]&#039;&#039;&#039;&lt;br /&gt;
Added an include file so that you need only use the macros provided.  Now the plugin is translatable if your language is not included please add it to the list [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=162550 in this forum.]  Changed error reporting prefix to enable better international support.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2003-11-27]&#039;&#039;&#039;&lt;br /&gt;
Added error reporting functionality.  Check for &#039;error:&#039; at the start of the returned string on the stack.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2003-11-26]&#039;&#039;&#039;&lt;br /&gt;
Fixed plugin crash in Win9x Family.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[UPDATE: 2003-11-18]&#039;&#039;&#039;&lt;br /&gt;
Fixed problem with plugin reporting &#039;FontFamily&#039; instead of &#039;FontName&#039; affecting certain fonts, e.g. Arial Bold and Arial were both being reported as Arial.&lt;br /&gt;
&lt;br /&gt;
Vytautas&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>550771955</name></author>
	</entry>
</feed>