VK_BACK is not working when button is clicked [Solved]
-
Hi All, I am working on one application where i use an edit control and on button click i just want to delete the text of edit box using VK_BACK. my code is
HWND hWnd = NULL; hWnd = ::GetDlgItem(m\_hWnd, IDC\_EDIT); ::SendMessage(hWnd, WM\_KEYDOWN, (WPARAM)0, (LPARAM)VK\_BACK);
Thanks in advance. :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
modified on Wednesday, July 30, 2008 8:28 AM
-
Hi All, I am working on one application where i use an edit control and on button click i just want to delete the text of edit box using VK_BACK. my code is
HWND hWnd = NULL; hWnd = ::GetDlgItem(m\_hWnd, IDC\_EDIT); ::SendMessage(hWnd, WM\_KEYDOWN, (WPARAM)0, (LPARAM)VK\_BACK);
Thanks in advance. :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
modified on Wednesday, July 30, 2008 8:28 AM
Perhaps the Edit control is coded to respond to WM_KEYUP rather than WM_KEYDOWN, or maybe these are ignored in favour of WM_CHAR. It's possible, although unlikely, that you might need to send all 3 in the right order. If none of that works you'll need to do a GetText and something to get the cursor position, remove a character yourself and do a SetText to put the modified text back.
"The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)
-
Hi All, I am working on one application where i use an edit control and on button click i just want to delete the text of edit box using VK_BACK. my code is
HWND hWnd = NULL; hWnd = ::GetDlgItem(m\_hWnd, IDC\_EDIT); ::SendMessage(hWnd, WM\_KEYDOWN, (WPARAM)0, (LPARAM)VK\_BACK);
Thanks in advance. :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
modified on Wednesday, July 30, 2008 8:28 AM
Is using VK_BACK a constraint?
Shilpi Boosar wrote:
button click i just want to delete the text of edit box "
Since you want to delete the text in the edit box why don't you simply use SetWindowText(/*windowhandle*/,"").
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Is using VK_BACK a constraint?
Shilpi Boosar wrote:
button click i just want to delete the text of edit box "
Since you want to delete the text in the edit box why don't you simply use SetWindowText(/*windowhandle*/,"").
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
No because my main concern is to delete the text of edit box using VK_BACK when i click the button.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
This should work then.
::SendMessage (hwndEdit,WM_CHAR,(WPARAM)VK_BACK,(LPARAM)1);
Rate it if this helps
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
This should work then.
::SendMessage (hwndEdit,WM_CHAR,(WPARAM)VK_BACK,(LPARAM)1);
Rate it if this helps
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_