News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Delete last character

Started by gromit, October 11, 2008, 09:37:16 PM

Previous topic - Next topic

gromit

Hi All
Im sure i am missing something really obvious here

But i have hunted high and low an the net and cannot solve this simple question


Using
SendMessage(GetDlgItem(g_hwnd,IDC_GENERAL_ENTRYBOX),EM_REPLACESEL   ,(WPARAM)TRUE,(LPARAM)L"replacewith");

works fine when i want to insert at the caret or delete selection and insert another character

but what do i send in the !,(LPARAM)L"replacewith"!
to delete the last character

having tried all manner of "\?" characters
my last attempt was to try
SendMessage(GetDlgItem(g_hwnd,IDC_GENERAL_ENTRYBOX),EM_SETSEL ,(WPARAM)end,(LPARAM)end);
SendMessage((GetDlgItem(g_hwnd, IDC_GENERAL_ENTRYBOX)),WM_CLEAR,0,0);
that did not work either

Any help would be appreciated Thanks

JohnF

This seems to work.


txtlen = SendMessage(GetDlgItem(hwndDlg, 4002), WM_GETTEXTLENGTH, 0, 0);
SendMessage(GetDlgItem(hwndDlg, 4002), EM_SETSEL, txtlen-1, txtlen);
SendMessage(GetDlgItem(hwndDlg, 4002), EM_REPLACESEL, TRUE, (LPARAM)"");


John

gromit

 :-[

Indeed it does

I am sending soft button pentaps to this edit box and not keypresses

I was losing focus to the said editbox and not doing it right at all

Big Thanks John