Archive: CB_FINDSTRING using SendMessage problem


CB_FINDSTRING using SendMessage problem
Hello,
I am having trouble searching for a string in a combobox using winmessages.nsh
I must be doing something wrong because every time it just returns -1. I am not sure where i am going wrong. Here is some code to try it on...


Name test
OutFile test.exe
XPStyle on
!include nsDialogs.nsh
!include "WinMessages.nsh"
Page custom GUI
Page instfiles


var /global testbutton
var /global COMBOBOX


Function GUI

nsDialogs::Create 1018


${NSD_CreateButton} 0 190 30% 12u "test button"
pop $testbutton
${NSD_OnClick} $testbutton testbutton


${NSD_CreateComboBox} 0 30 80% 12u "test"
pop $COMBOBOX
${NSD_CB_AddString} $COMBOBOX "test"
${NSD_CB_SelectString} $COMBOBOX "test"

nsDialogs::Show
FunctionEnd


Function testbutton

StrCpy $R0 "test"
SendMessage $COMBOBOX ${CB_FINDSTRING} -1 $R0 $1
messagebox mb_ok "$1"

FunctionEnd

Section ""
SectionEnd


Many thanks if you have any help! :)

With SendMessage you need to prefix string parameters with "STR:".

Example:

Function testbutton

StrCpy $R0 "test"
SendMessage $COMBOBOX ${CB_FINDSTRING} -1 "STR:$R0" $1
messagebox mb_ok "$1"

FunctionEnd


PaR

thank you so much :)