Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. VK_BACK is not working when button is clicked [Solved]

VK_BACK is not working when button is clicked [Solved]

Scheduled Pinned Locked Moved C / C++ / MFC
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ShilpiP
    wrote on last edited by
    #1

    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

    M _ 2 Replies Last reply
    0
    • S ShilpiP

      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

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      0
      • S ShilpiP

        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

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        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_

        S 1 Reply Last reply
        0
        • _ _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_

          S Offline
          S Offline
          ShilpiP
          wrote on last edited by
          #4

          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

          _ 1 Reply Last reply
          0
          • S ShilpiP

            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

            _ Offline
            _ Offline
            _AnsHUMAN_
            wrote on last edited by
            #5

            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_

            S 1 Reply Last reply
            0
            • _ _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_

              S Offline
              S Offline
              ShilpiP
              wrote on last edited by
              #6

              Thanks It Works :)

              Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups