Click here to Skip to main content
15,122,406 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ question. Please help me out Pin
Amarnath S3-Nov-12 21:49
professionalAmarnath S3-Nov-12 21:49 
Questionhow to return value after user input Pin
Member 21198442-Nov-12 6:11
MemberMember 21198442-Nov-12 6:11 
AnswerRe: how to return value after user input Pin
Richard MacCutchan2-Nov-12 7:25
mveRichard MacCutchan2-Nov-12 7:25 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 9:16
MemberMember 21198442-Nov-12 9:16 
GeneralRe: how to return value after user input Pin
Richard MacCutchan2-Nov-12 11:19
mveRichard MacCutchan2-Nov-12 11:19 
AnswerRe: how to return value after user input Pin
Santhosh G_2-Nov-12 7:34
MemberSanthosh G_2-Nov-12 7:34 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 8:51
MemberMember 21198442-Nov-12 8:51 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 16:32
MemberSanthosh G_2-Nov-12 16:32 
Few comments.
1) First statement of CRetValTestDlg::OnGetString() set InFlag to false. Therefore m_TxInput.GetString() will return "".
Move InFlag = false to CRetValTestDlg::OnGetString(). Accessing a member variable outside of class is not a good.
2) First statement of CRetValTestDlg::OnGetNumber() set InFlag to false. Therefore m_TxInput.GetString() will return 0. Move InFlag = false to CRetValTestDlg::OnGetNumber().
3) modify CMyTextBox::OnKeyDown() like this
C#
if (nFlags == 28) // Enter press
{
    InFlag = true;
    GetWindowText(RetVal);
}

4) Need to identify Enter KeyPress in your EditControl. 3) Normally an Edit control will not get Enter key press, On Enter keypress, focused button click action will be performed.
One option is to change the style of your Edit control to Multi-line. Change MultiLine to true, or enable ES_MULTILINE for the CMyTextBox window style.
Another option is to identify enter keypress from PreTranslateMessage(), if "VK_ENTER" key down is occurred from edit control set your InFlag to true.
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 18:19
MemberMember 21198442-Nov-12 18:19 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 18:26
MemberSanthosh G_2-Nov-12 18:26 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 18:33
MemberMember 21198442-Nov-12 18:33 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 19:01
MemberSanthosh G_2-Nov-12 19:01 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 19:34
MemberMember 21198442-Nov-12 19:34 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 19:43
MemberSanthosh G_2-Nov-12 19:43 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 21:02
MemberMember 21198442-Nov-12 21:02 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 21:27
MemberSanthosh G_2-Nov-12 21:27 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 22:05
MemberMember 21198442-Nov-12 22:05 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 22:41
MemberSanthosh G_2-Nov-12 22:41 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 0:24
MemberMember 21198443-Nov-12 0:24 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 2:56
mveRichard MacCutchan3-Nov-12 2:56 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 5:40
MemberMember 21198443-Nov-12 5:40 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 7:07
mveRichard MacCutchan3-Nov-12 7:07 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 8:12
MemberMember 21198443-Nov-12 8:12 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 9:03
mveRichard MacCutchan3-Nov-12 9:03 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 16:40
MemberMember 21198443-Nov-12 16:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.