Click here to Skip to main content
16,011,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DoModal() and CDialog caption Pin
Maximilien19-Sep-02 5:37
Maximilien19-Sep-02 5:37 
GeneralRe: DoModal() and CDialog caption Pin
ns19-Sep-02 8:18
ns19-Sep-02 8:18 
GeneralVolatile variable... Pin
Anonymous19-Sep-02 4:40
Anonymous19-Sep-02 4:40 
GeneralRe: Volatile variable... Pin
TyMatthews19-Sep-02 4:50
TyMatthews19-Sep-02 4:50 
GeneralRe: Volatile variable... Pin
Raphael Kindt19-Sep-02 5:31
Raphael Kindt19-Sep-02 5:31 
GeneralRe: Volatile variable... Pin
Michael Dunn19-Sep-02 5:44
sitebuilderMichael Dunn19-Sep-02 5:44 
GeneralRe: Volatile variable... Pin
Raphael Kindt19-Sep-02 5:58
Raphael Kindt19-Sep-02 5:58 
GeneralPreTranslateMessage return value Pin
ns19-Sep-02 4:20
ns19-Sep-02 4:20 
I did the following which works fine. But then I changed (to see what happens ) the FALSE (in red in code) to TRUE and it still works
the way I want it. I am puzzled because I thought that returning TRUE in this function meant ignore the Enter. But it doesnt, and responds to Enter just like when it was FALSE.

BOOL CTest::PreTranslateMessage(MSG* pMsg) 
{

	
if   ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )

	if 	(GetFocus() ==& m_Ctestedit && (m_Ctestedit.GetWindowTextLength()) ) 
	{
		m_Ctestedit.GetWindowText(m_text);

		if(m_text=="a")
		{

		        EndDialog(IDOK);

		        return <code>FALSE</code>;  //still works if changed to TRUE. ???
		}
		else
		{
			m_Ctestedit.SetFocus();
		}
	}

	else
	{ 
		return TRUE;
	}

	return CDialog::PreTranslateMessage(pMsg);
}


Why does it do that? According to MSDN:

Return Value
Nonzero if the message was translated and should not be dispatched; zero if the message was not translated and should be dispatched.




Thanks,
ns
GeneralRe: PreTranslateMessage return value Pin
dazinith19-Sep-02 4:34
dazinith19-Sep-02 4:34 
Generalfile permissions check and cleanup Pin
dazinith19-Sep-02 4:14
dazinith19-Sep-02 4:14 
GeneralRe: file permissions check and cleanup Pin
TyMatthews19-Sep-02 5:11
TyMatthews19-Sep-02 5:11 
GeneralRe: file permissions check and cleanup Pin
dazinith19-Sep-02 5:46
dazinith19-Sep-02 5:46 
GeneralRe: file permissions check and cleanup Pin
TyMatthews19-Sep-02 5:50
TyMatthews19-Sep-02 5:50 
GeneralProblem running *.exe file without debug mode Pin
saekth19-Sep-02 3:45
saekth19-Sep-02 3:45 
GeneralRe: Problem running *.exe file without debug mode Pin
Nitron19-Sep-02 4:04
Nitron19-Sep-02 4:04 
GeneralRe: Problem running *.exe file without debug mode Pin
saekth19-Sep-02 4:19
saekth19-Sep-02 4:19 
GeneralRe: Problem running *.exe file without debug mode Pin
Nitron19-Sep-02 4:31
Nitron19-Sep-02 4:31 
GeneralBinary Multiplication code. Pin
Michael Liu19-Sep-02 3:43
Michael Liu19-Sep-02 3:43 
GeneralFree source code of a flex grid control Pin
Anonymous19-Sep-02 3:26
Anonymous19-Sep-02 3:26 
GeneralRe: Free source code of a flex grid control Pin
Mazdak19-Sep-02 3:50
Mazdak19-Sep-02 3:50 
GeneralTRACE for __int64 values Pin
Anonymous19-Sep-02 3:12
Anonymous19-Sep-02 3:12 
GeneralRe: TRACE for __int64 values Pin
Pavel Klocek19-Sep-02 3:52
Pavel Klocek19-Sep-02 3:52 
Generalestimate user permissions Pin
f.o.b19-Sep-02 2:56
f.o.b19-Sep-02 2:56 
GeneralRe: estimate user permissions Pin
Mazdak19-Sep-02 3:46
Mazdak19-Sep-02 3:46 
GeneralRe: estimate user permissions Pin
f.o.b19-Sep-02 4:12
f.o.b19-Sep-02 4:12 

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.