I am having trouble understanding setting up %EM_FINDTEXT from the win32api.hlp file. Here is a snippet of the code I have at this point:
What I am trying to do is select from a list of Book titles in the combo box and then find that title in the text. A msgbox statement tells me that the find.lpstrText is being initialized with the proper selection when I select it from the dropdown list. The hlp guide mentioned that chrg.cpmin = 0 and chrg.cpmax = -1 would set the range for the entire control and a pointer to the "find" UDT needs to be passed, so I am speculating there something else I have missed that needs to be setup first or have I setup something improperly. Checking result with a msgbox statement always returns 0 and it is supposed to, according to the hlp guide, return either the zero-based character position of the next match or -1 if no match was found. Also, the hlp guide mentioned two constants FT_MATCHCASE and FT_WHOLEWORD for flags with %EM_FINDTEXT but I did not find these in the include file. I would like to use the FT_WHOLEWORD constant and I also assume I would have to use %EM_SETSEL to actually move the caret to the starting point of the found text since my understanding from the hlp guide is that %EM_FINDTEXT only returns the starting and ending positions of the found text or am I misunderstanding this as well. The copyright year on the include file is 1997, is there a newer file or can you just tell me what the values are for these and I can just update the include file myself.
Thanks,
Adam Ritchie
[This message has been edited by Adam Ritchie (edited April 07, 2000).]
Code:
... Case %WM_COMMAND Select Case CbCtlMsg Case %CBN_SELCHANGE Local find As FINDTEXTAPI Local item As String Local number As Long local result as Long Local pfind As Long Ptr ComboBox Get Text CbHndl,%IDC_BOOK To item find.chrg.cpmin = 0 find.chrg.cpmax = -1 find.lpstrText = StrPtr(item) pfind = VarPtr(find) Control Send hWndClient,%IDC_EDIT,%EM_FINDTEXT,0,@pfind To result ...
Thanks,
Adam Ritchie
[This message has been edited by Adam Ritchie (edited April 07, 2000).]
Comment