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. EditBox control Problem

EditBox control Problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorial
3 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
    shiv nand
    wrote on last edited by
    #1

    I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .

    A L 2 Replies Last reply
    0
    • S shiv nand

      I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      For that you need to implement your own EditBox, like the example given ( Create your own controls - the art of subclassing[^]) And inside which you u have overiride the PreTranslateMessage. eg:-

      BOOL MyEditCtrl::PreTranslateMessage(MSG* pMsg)
      {
      // disable mouse and keyboard copy
      switch( pMsg->message )
      {
      case WM_KEYDOWN:
      {
      switch( pMsg->wParam )
      {
      case 0x56:
      {
      if( GetKeyState(VK_CONTROL) )
      return true;
      }
      break;
      }
      }
      break;

      case WM\_RBUTTONDOWN:
      	{
      	     return true;
      	}
      	break;
      }
      
      return CMyEdit::PreTranslateMessage(pMsg);
      

      }

      Величие не Бога может быть недооценена.

      1 Reply Last reply
      0
      • S shiv nand

        I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .

        L Offline
        L Offline
        Le rner
        wrote on last edited by
        #3

        Check this:: http://www.codeguru.com/cpp/controls/editctrl/maskededitcontrols/article.php/c9771[^]

        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