| | |
Need help for MFC editbox
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2009
Posts: 10
Reputation:
Solved Threads: 0
Hi,
I am using visual studio 2008, C++ MFc. I have create 2 edit box. I will let user key in at the editbox1. Then i will get line and paste what user have key in to editbox2. I want it to be something like hyper terminal format. That mean when user key in "how r u" in editbox1 then press 'enter', the program should automatic get "how r u" (what the user key in) and paste/copy/send it to editbox2. Hope that someone can help me out with this. So far i can only get the line from editbox1 and paste it to editbox 2 with the help of button and with some errors.
In the button function:
UpdateData(TRUE);
int nCurrentLine = m_command.LineFromChar(-1);
int lineLen = m_command.LineLength(nCurrentLine);
LPTSTR p = m_strCommand.GetBuffer(lineLen+1);
m_command.GetLine(nCurrentLine, p);
m_strCommand.ReleaseBuffer(lineLen);
CString abc = m_strCommand;
SetDlgItemText(IDC_EDIT2, abc);
UpdateData(TRUE);
I am using visual studio 2008, C++ MFc. I have create 2 edit box. I will let user key in at the editbox1. Then i will get line and paste what user have key in to editbox2. I want it to be something like hyper terminal format. That mean when user key in "how r u" in editbox1 then press 'enter', the program should automatic get "how r u" (what the user key in) and paste/copy/send it to editbox2. Hope that someone can help me out with this. So far i can only get the line from editbox1 and paste it to editbox 2 with the help of button and with some errors.
In the button function:
UpdateData(TRUE);
int nCurrentLine = m_command.LineFromChar(-1);
int lineLen = m_command.LineLength(nCurrentLine);
LPTSTR p = m_strCommand.GetBuffer(lineLen+1);
m_command.GetLine(nCurrentLine, p);
m_strCommand.ReleaseBuffer(lineLen);
CString abc = m_strCommand;
SetDlgItemText(IDC_EDIT2, abc);
UpdateData(TRUE);
nicolasahm, I would investigate the Dialog Data Exchange and Validation capability or DDX mechanism within the MFC. I think this may help you with what you want to do. This function is called to carry out the exchange of data between variables in the dialog and it's controls. Also I'm not sure exactly what you want to do but it sounds like you want to have the user press the <Enter> key to transfer the text from one dialog control to the other. The "Want Return" property of the dialog control set to "True" uses the <Enter> key as a return character insertion mechanism, otherwise it should effectively call the button function.
![]() |
Similar Threads
- Passing FFT data to an Editbox in an MFC App (C++)
- How do i do chat program using MFC (Microsoft Foundation Classes) and Visual Basic? (Visual Basic 4 / 5 / 6)
- Subclassed Editbox Control: Do I need to create 2 subclasses for two edit controls? (C++)
- newbie needs help, basic mfc stuff (C++)
- Quit abruptly in MFC app (C++)
- Using MFC in a Static Library (C++)
- MFC diagram maker type thing (C)
Other Threads in the C++ Forum
- Previous Thread: zodiac sign calculations
- Next Thread: How do I create my own compiler directives?
| Thread Tools | Search this Thread |
api application array arrays based binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





