Thank you :]
When using ListView, Korean is not expressed, but strange characters are displayed. (Photo attached) And some characters are well included in List(NSISList), but some characters are not. I tried adding the source below, but the text didn't show up properly. What sources do I need to add to get the text to look right? I am using NSIS 3.x version.
!ifndef LVM_GETITEMTEXT
!define /math LVM_GETITEMTEXTA ${LVM_FIRST} + 45
!define /math LVM_GETITEMTEXTW ${LVM_FIRST} + 115
${_NSIS_DEFAW} LVM_GETITEMTEXT
!endif
ex) 서대문 = "서", 대구 = ""
Function ListTest
${List.Create} Aerch
${List.Add} Serch "서대문구"
${List.Get} $0 Serch 0
MessageBox MB_OK $0
FunctionEnd
; Return $0 = 서
Unicode True
at the start of your script.Characters that "look Chinese" is a symptom of treating ASCII as UTF-16. Strings cut off after the first character is a symptom of treating UTF-16 as ASCII (not a Unicode plug-in?).
This works for me:
Unicode True
RequestExecutionLevel user
!include nsDialogs.nsh
!define _COMMCTRL_NSH_VERBOSE 3
!include commctrl.nsh
Section
SectionEnd
Page custom nsDialogsPage
Var lv
Function msgboxtext
Pop $0
SendMessage $lv ${LVM_GETSELECTIONMARK} 0 0 $8
StrCpy $9 1
${If} $8 = -1
Return
${EndIf}
System::Call '*(&t${NSIS_MAX_STRLEN})p.r3'
System::Call "*(i, i, i, i, i, p, i, i, i) p (0, 0, $9, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
System::Call "User32::SendMessage(p, i, p, p) p ($lv, ${LVM_GETITEMTEXT}, $8, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
System::Free $1
System::Free $3
MessageBox mb_ok $4
FunctionEnd
Function nsDialogsPage
nsDialogs::Create 1018
Pop $0
${NSD_CreateButton} 0 0 100% 12u "Get text"
Pop $9
${NSD_OnClick} $9 msgboxtext
nsDialogs::CreateControl /NOUNLOAD ${WC_LISTVIEW} ${__NSD_ListView_STYLE}|${WS_TABSTOP} ${__NSD_ListView_EXSTYLE} 0 13u 100% -13u ""
Pop $lv
${NSD_LV_InsertColumn} $lv 0 100 "column 0"
${NSD_LV_InsertColumn} $lv 1 70 "서대문"
${NSD_LV_InsertItem} $lv 0 '서대문'
${NSD_LV_SetItemText} $lv 0 1 '서대문 서대문'
${NSD_LV_InsertItem} $lv 1 '2 서대문'
${NSD_LV_SetItemText} $lv 1 1 '2.2 서대문 서대문'
nsDialogs::Show
FunctionEnd