Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   CB_FINDSTRING using SendMessage problem (http://forums.winamp.com/showthread.php?t=315750)

dougcvc 27th December 2009 03:22

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...

code:

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! :)

{_trueparuex^} 27th December 2009 15:02

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

Example:
code:
Function testbutton

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

FunctionEnd



PaR

dougcvc 27th December 2009 20:08

thank you so much :)


All times are GMT. The time now is 18:04.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.