Normally that would research a string into the richedit editor. But it's not what I get.
EM_FINDTEXTEX returns 0 and both cpMin, cpMax = 0.
Do I have to convert the input string to UniCode?
In WM_INITDIALOG I have the string I want to search. The problem isin the case IDC_BUTTON_01
Need your help?
Thanks in advance
LRESULT CALLBACK FindDlgProc(HWND __hWnd,UINT __uMsg,WPARAM __wParam,LPARAM __lParam)
{
int _iID ;
HWND _hEdit ;
TCITEM _Tci ;
LPEDI_FIND_STRING _lpEdit_Find ;
_iID = LOWORD(__wParam) ;
switch (__uMsg)
{
case WM_INITDIALOG : SendMessage(GetDlgItem(__hWnd,IDC_STATIC_01),WM_SETFONT,(WPARAM) hFont_00,TRUE) ;
SendMessage(GetDlgItem(__hWnd,IDC_EDIT_01),WM_SETFONT,(WPARAM) hFont_00,TRUE) ;
memset(&Edit_Find,0,sizeof(EDI_FIND_STRING)) ;
Edit_Find.Text.cb = MAX_STRING ;
Edit_Find.Text.codepage = CP_ACP ;
Edit_Find.Text.flags = GT_SELECTION ;
Edit_Find.Text.lpDefaultChar = NULL ;
Edit_Find.Text.lpUsedDefChar = NULL ;
_Tci.mask = TCIF_PARAM ;
TabCtrl_GetItem(hTabTop,TabCtrl_GetCurSel(hTabTop),&_Tci) ;
_hEdit = ((LPEDI_WORK) _Tci.lParam)->hEdit ;
SendMessage(_hEdit,EM_GETTEXTEX,(WPARAM) &Edit_Find.Text,(LPARAM) Edit_Find.szString) ;
SendMessage(_hEdit,EM_GETTEXTRANGE,0,(LPARAM) &Edit_Find.TextRange) ;
SetDlgItemText(__hWnd,IDC_EDIT_01,(LPSTR) Edit_Find.szString) ;
CheckRadioButton(__hWnd,IDC_RADIO_01,IDC_RADIO_03,IDC_RADIO_02) ;
return (TRUE) ;
case WM_COMMAND : switch(_iID)
{
case IDC_BUTTON_01 : _lpEdit_Find = &Edit_Find ;
Edit_Find.bFind = 0 ;
if(IsDlgButtonChecked(__hWnd,IDC_CHECK_01) == BST_CHECKED)
Edit_Find.bFind |= FR_WHOLEWORD ;
if(IsDlgButtonChecked(__hWnd,IDC_CHECK_02) == BST_CHECKED)
Edit_Find.bFind |= FR_MATCHCASE ;
if(IsDlgButtonChecked(__hWnd,IDC_RADIO_03) == BST_CHECKED)
{
Edit_Find.Find.chrg.cpMin = 0 ;
Edit_Find.Find.chrg.cpMax = -1 ;
}
else
{
if(IsDlgButtonChecked(__hWnd,IDC_RADIO_02) == BST_CHECKED)
{
Edit_Find.bFind |= FR_DOWN ;
Edit_Find.Find.chrg.cpMin = Edit_Find.TextRange.chrg.cpMax ;
Edit_Find.Find.chrg.cpMax = -1 ;
}
else
{
Edit_Find.Find.chrg.cpMin = 0 ;
Edit_Find.Find.chrg.cpMax = Edit_Find.TextRange.chrg.cpMin ;
}
}
GetDlgItemText(__hWnd,IDC_EDIT_01,Edit_Find.szString,MAX_STRING) ;
Edit_Find.Find.lpstrText = Edit_Find.szString ;
SendMessage(hEdit,EM_FINDTEXTEX,(WPARAM) Edit_Find.bFind,(LPARAM) &Edit_Find.Find) ;
break ;
case IDOK : if(HIWORD(__wParam) == BN_CLICKED)
{
EndDialog(__hWnd,TRUE) ;
return (TRUE) ;
}
}
}
return (FALSE) ;
}