I have some code which strips out illegal characters from a user entered string upon the ON_EN_CHANGE call. So need to correct the curser position if any are removed.
To do so I have been attempting to use GetSel to retrieve the position, then setsel to set it as below. f is another int variable.
m_ExportDirectory.GetWindowTextA(directory);
//characters removed here
if (rem > 0)
{
int j;
m_ExportDefaultName.GetSel(f, j);
m_ExportDirectory.SetWindowTextA(directory);
m_ExportDefaultName.SetSel(f-rem, f-rem);
}
But getsel always sets both f & j to 0. I have attempted moving its call to above the GetWindowText but with no change.
Am I doing something stupid? If not Any ideas?
Thanks