Old 24th May 2010, 08:16   #1
jiake
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_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section Install

SectionEnd

Function CreatePage

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

    
nsDialogs::Create 1018
    Pop 
$0
    
${If} $== error
        Abort
    
${EndIf}
    
    ${
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
    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'
    
SendMessage $${LVM_SETBKCOLOR0 0xC7EDCC
    nsDialogs
::Show
FunctionEnd

Function DirSelect

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

FunctionEnd 
Attached Thumbnails
Click image for larger version

Name:	interface.png
Views:	1932
Size:	14.6 KB
ID:	47008  
jiake is offline   Reply With Quote
Old 24th May 2010, 11:54   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
until somebody abstracts the System plugin calls to manipulate these, you might be easier off with either http://nsis.sourceforge.net/EmbeddedLists_plug-in or http://nsis.sourceforge.net/InstallOption****plug-in
Animaether is offline   Reply With Quote
Old 1st July 2010, 03:29   #3
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
Hey, a person (username gfm688) in Dreams8.com write it to access the ListView control, and I made a demo using it:
Attached Thumbnails
Click image for larger version

Name:	listview.png
Views:	2351
Size:	23.8 KB
ID:	47188  
jiake is offline   Reply With Quote
Old 1st July 2010, 10:08   #4
JohaViss
Junior Member
 
Join Date: Apr 2010
Posts: 29
Hi Jiake,

This looks great.
Any chance to provide the source to this?
JohaViss is offline   Reply With Quote
Old 1st July 2010, 13:21   #5
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
Quote:
Originally Posted by JohaViss View Post
Hi Jiake,

This looks great.
Any chance to provide the source to this?
See this thread:
http://forums.winamp.com/showthread.php?p=2676715
jiake is offline   Reply With Quote
Reply
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