Send backspace to a TextBox

Hello,

I'm trying to delete some lines in a TextBox,

This works perfect with a newline...
SendMessage(hText1, EM_REPLACESEL, 0, (LPARAM)"\r\n");

But this will only give me some random ASCII-text "" in the TextBox
SendMessage(hText1, EM_REPLACESEL, 0, (LPARAM)"\b");

Last edited on
This worked for me (note that edit1 is the handle to my edit bo window):

SendMessage(edit1, WM_CHAR ,(WPARAM)VK_BACK, 0);
1
2
3
4
GetDlgItemText(hwnd, ID_EDITBOX, szBuffer, MAX_PATH);
int len = strlen(szBuffer)
szBuffer[len-1]=0;
SetDlgItemText(hwnd,ID_EDITBOX,szBuffer);


The above removes one character from the edit control, so that if the edit control originally read "textbox" the new result in the edit control would read "textbo"
Last edited on
Nice!

Thanks, both worked for me!

The first one you could set how many lines you wanna delete also,

SendMessage(edit1, WM_CHAR ,(WPARAM)VK_BACK, (LPARAM)2); // Deletes 2 lines
Topic archived. No new replies allowed.