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. Get Controll?

Get Controll?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
2 Posts 2 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.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    Hello, I have this code! HWND hwndTextBox = NULL; hwndTextBox = GetDlgItem(hwndDlg,IDC_EDIT1); if(CDesktop::None != (CDesktop::ShowStatus)iIndex) { if(GetWindowText(hwndTextBox,text,MAX)) bSuccess=g_objDesktop.SetDesktopWallpaper (text,CDesktop::ShowStatus)iIndex); } But now I want to use it in a dialog (MFC) and I dont now how to get the text as a char enter in the EDIT1 as it supose to do. Is there anyone that can help me?

    A 1 Reply Last reply
    0
    • L Larsson

      Hello, I have this code! HWND hwndTextBox = NULL; hwndTextBox = GetDlgItem(hwndDlg,IDC_EDIT1); if(CDesktop::None != (CDesktop::ShowStatus)iIndex) { if(GetWindowText(hwndTextBox,text,MAX)) bSuccess=g_objDesktop.SetDesktopWallpaper (text,CDesktop::ShowStatus)iIndex); } But now I want to use it in a dialog (MFC) and I dont now how to get the text as a char enter in the EDIT1 as it supose to do. Is there anyone that can help me?

      A Offline
      A Offline
      AntonlioX
      wrote on last edited by
      #2

      :laugh:Hi Larsson : I could not understand your meaning .But if you want to get the char when you click a certain key of keyboard ,you can use the message map to hook the key down message. The example is in the following : // you should ooverride the "PreTranslateMessage" BOOL CMyClientDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class switch(pMsg->message) { case WM_KEYDOWN : switch(pMsg->wParam) { case 'A': //add code here to get the char A break; case 'B': //add code here to get the char B break; case 'B': //add code here to get the char C break; } break; case WM_KEYUP: switch(pMsg->wParam) { case 'A': //add code here to get the char A break; case 'B': //add code here to get the char B break; case 'B': //add code here to get the char C break; } } break; } return CDialog::PreTranslateMessage(pMsg); } AntonlioX

      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