Click here to Skip to main content
15,886,693 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 20:27
Santhosh G_2-Nov-12 20:27 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 21:05
Member 21198442-Nov-12 21:05 
GeneralRe: how to return value after user input Pin
Santhosh G_2-Nov-12 21:41
Santhosh G_2-Nov-12 21:41 
GeneralRe: how to return value after user input Pin
Member 21198442-Nov-12 23:24
Member 21198442-Nov-12 23:24 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 1:56
mveRichard MacCutchan3-Nov-12 1:56 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 4:40
Member 21198443-Nov-12 4:40 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 6:07
mveRichard MacCutchan3-Nov-12 6:07 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 7:12
Member 21198443-Nov-12 7:12 
Dear sir, i really appreciate your and Santhosh suggestion. i do. but the thing is bit difference what i am looking for. maybe i am not able to describe very well, what i am looking for. sorry for that. because my English is not good enough. so please don't get me wrong. once again i am trying to explain what i need to do. and what i come up to.

i need to make function that return value after press Enter key. not directly and not in any other way. but from function when it call from outer class.

this is the event when user press button in dlg class.
C++
void CRetValTestDlg::OnGetString() 
{
	m_TxInput.InFlag = false;
	CString s = m_TxInput.GetString();
	m_TxOutput.SetWindowText (s);
}

and this is CMyTextBox calss member function which is call from dlg class on button press. which need to return value.
C++
CString CMyTextBox::GetString()
{
	if (InFlag == true)
		return RetVal;
	return "";
}


now i have come upto this
C++
CString CMyTextBox::GetString()
{
	while (InFalg != true) // this is infinite loop but
	{
		DoEvents(); // doEvents hole for it so it wait until it get event
		if (InFlag == true) // the InFlag = true when user press Enter;
		return RetVal; // and return value
	}
	return ""; // else return "";
}


this is work. but when i use While and DoEvents the processor took lot of work. it took all most 50% of CPU used. and which is really not good. i think. and some time it does not come out from that loop when user left so when the program close. it remain in task manager. and CUP running.

now What i am looking for is -> is there any other way to wait till event. maybe using CEvent or CallBack or threading or something else. without using lot of CPU used. because i don't know anything about them. i have never use.
C++
CString CMyTextBox::GetString()
{
//====================== Here i am looking for help =============================
// wait for event here or WaitTill (InFlag !=true); in this line i need help.
//==================================================================================
	if (InFlag == true)
		return RetVal;
	return "";
}


i hope this time i could able to tell what i need for. this is really important for me.
so Please Please Help.
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 8:03
mveRichard MacCutchan3-Nov-12 8:03 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 15:40
Member 21198443-Nov-12 15:40 
GeneralRe: how to return value after user input Pin
Richard MacCutchan3-Nov-12 21:23
mveRichard MacCutchan3-Nov-12 21:23 
GeneralRe: how to return value after user input Pin
Member 21198443-Nov-12 22:59
Member 21198443-Nov-12 22:59 
SuggestionRe: how to return value after user input Pin
David Crow4-Nov-12 16:28
David Crow4-Nov-12 16:28 
Questionproblem with sprintf_s() on win 7 Pin
Member 93537761-Nov-12 21:57
Member 93537761-Nov-12 21:57 
AnswerRe: problem with sprintf_s() on win 7 Pin
Santhosh G_1-Nov-12 22:34
Santhosh G_1-Nov-12 22:34 
GeneralRe: problem with sprintf_s() on win 7 Pin
Member 93537764-Nov-12 16:46
Member 93537764-Nov-12 16:46 
GeneralRe: problem with sprintf_s() on win 7 Pin
Santhosh G_4-Nov-12 17:08
Santhosh G_4-Nov-12 17:08 
AnswerRe: problem with sprintf_s() on win 7 Pin
CPallini1-Nov-12 22:48
mveCPallini1-Nov-12 22:48 
GeneralRe: problem with sprintf_s() on win 7 Pin
Member 93537764-Nov-12 16:46
Member 93537764-Nov-12 16:46 
GeneralRe: problem with sprintf_s() on win 7 Pin
CPallini4-Nov-12 22:02
mveCPallini4-Nov-12 22:02 
AnswerRe: problem with sprintf_s() on win 7 Pin
Sarath C5-Nov-12 22:14
Sarath C5-Nov-12 22:14 
AnswerRe: problem with sprintf_s() on win 7 Pin
Member 935377613-Nov-12 22:48
Member 935377613-Nov-12 22:48 
Questionhow to get motherboard SN Pin
buffay1-Nov-12 19:42
buffay1-Nov-12 19:42 
AnswerRe: how to get motherboard SN Pin
Richard MacCutchan2-Nov-12 0:37
mveRichard MacCutchan2-Nov-12 0:37 
QuestionChart Control Pin
Tom Paronis1-Nov-12 6:04
Tom Paronis1-Nov-12 6:04 

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.