Prev Previous Post   Next Post Next
Old 24th May 2010, 07:16   #1
Senior Member
jiake's Avatar
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
How to access a SysListView32 control

I write a script to create a SysListView32 control using nsDialogs, but it could only show a box. I want to insert columns and items into it, but after read the Messages of SysListView32 control at MSDN, I know that I must use API to access this control as some of the messages need "the pointer to an LVCOLUMN structure that contains the attributes of the new column".

I don't know how to use System plug-in to access it. I hope that nsDialogs provide more controls support, such as msctls_trackbar32, SysListView32, SysTreeView32 etc. in future.
PHP Code:
!include "MUI2.nsh"
;!include "UsefulLib.nsh"

Name "List View"
OutFile SysListView32.exe
InstallDir $TEMP

ShowInstDetails Show

Page custom CreatePage
!insertmacro MUI_LANGUAGE "English"

Section Install


Function CreatePage

!insertmacro MUI_HEADER_TEXT "List view control" "A SysListView32 control created by nsDialogs plugin"

nsDialogs::Create 1018
${If} $== error
NSD_CreateLabel0u 0u 300u 8u "Please specify the target folder where to install this software:"
Pop $1
${NSD_CreateFileRequest0u 12u 232u 12u "D:\TTPlayer"
Pop $2
${NSD_CreateBrowseButton240u 12u 60u 12u "&Browse..."
Pop $3
${NSD_OnClick} $3 DirSelect
${NSD_CreateGroupBox0u 28u 300u 112u "Drive space:"
Pop $4
!define IDC_LISTVIEW        1600
!define LVS_REPORT          0x00000001
!define LVS_SINGLESEL       0x00000004
!define LVM_SETBKCOLOR      0x00001001
!define LVM_INSERTITEM      0x00001007
!define LVM_INSERTCOLUMN    0x0000101B
!define LVM_SETCOLUMNWIDTH  0x0000101E
Using nsDialogs
::CreateControl /NOUNLOAD SysListView32 ${DEFAULT_STYLES}|${WS_TABSTOP}|${LVS_REPORT}|${LVS_SINGLESEL} ${WS_EX_CLIENTEDGE5u 40u 290u 95u "ListView"
Pop $5
Using Win32 API
# FindWindow $0 "#32770" "" $HWNDPARENT
    # System::Call 'kernel32::GetModuleHandle(i 0) i.r5'
    # System::Call 'user32::CreateWindowEx(i ${WS_EX_CLIENTEDGE}, t "SysListView32", t "", i ${DEFAULT_STYLES}|${WS_TABSTOP}|${LVS_REPORT}|${LVS_SINGLESEL}, i 8, i 65, i 434, i 154, i $0, i ${IDC_LISTVIEW}, i r5, i 0) i.r5'

Function DirSelect

${NSD_GetText} $2 $R0
::SelectFolderDialog "$(^DirBrowseText)" "$R0"
Pop $R0
${IfNot$R0 == error
${NSD_SetText} $2 $R0

Attached Thumbnails
Click image for larger version

Name:	interface.png
Views:	1936
Size:	14.6 KB
ID:	47008  
jiake is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump