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