Click here to Skip to main content
15,917,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to automate the DSN creation for a database. Pin
Mark Salsbery14-Sep-07 7:21
Mark Salsbery14-Sep-07 7:21 
QuestionPlease Help Pin
Programm3r13-Sep-07 22:44
Programm3r13-Sep-07 22:44 
QuestionHow to identify Enter Key pressed by user ? Pin
Atul2313-Sep-07 22:44
Atul2313-Sep-07 22:44 
AnswerRe: How to identify Enter Key pressed by user ? Pin
chandu00413-Sep-07 22:52
chandu00413-Sep-07 22:52 
AnswerRe: How to identify Enter Key pressed by user ? Pin
Maxwell Chen13-Sep-07 22:52
Maxwell Chen13-Sep-07 22:52 
AnswerRe: How to identify Enter Key pressed by user ? Pin
sps-itsec4613-Sep-07 23:16
sps-itsec4613-Sep-07 23:16 
AnswerRe: How to identify Enter Key pressed by user ? Pin
Hamid_RT13-Sep-07 23:34
Hamid_RT13-Sep-07 23:34 
AnswerRe: How to identify Enter Key pressed by user ? Pin
David Crow14-Sep-07 3:17
David Crow14-Sep-07 3:17 
The use of PreTranslateMessage() *might* work, but most implementations are incorrect. The other downside is that it permanently ties the child control to the parent. A better solution is to derive a class from CEdit. Override the OnGetDlgCode() method and return DLGC_WANTALLKEYS. Then override the OnChar() method like:

void CMyEdit::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags ) 
{
    switch (nChar)
    {
        case VK_RETURN:
            GetParent()->SendMessage(some_custom_msg, GetDlgCtrlID(), (LPARAM) this);
            return;
    }
 
    CEdit::OnChar( nChar, nRepCnt, nFlags );
}
When the edit control "sees" the Enter key, it posts a message to the parent indicating such. The parent can then respond accordingly, if at all.


"A good athlete is the result of a good and worthy opponent." - David Crow

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


QuestionHow early can a Windows service start up? (WinXP and Vista) Pin
Maxwell Chen13-Sep-07 22:26
Maxwell Chen13-Sep-07 22:26 
QuestionHelp needed Pin
Y_Kaushik13-Sep-07 21:29
Y_Kaushik13-Sep-07 21:29 
AnswerRe: Help needed Pin
nbugalia13-Sep-07 21:42
nbugalia13-Sep-07 21:42 
GeneralRe: Help needed Pin
Y_Kaushik13-Sep-07 22:53
Y_Kaushik13-Sep-07 22:53 
GeneralRe: Help needed Pin
nbugalia13-Sep-07 23:23
nbugalia13-Sep-07 23:23 
QuestionWhat is The difference in .DLL ???? Pin
GauranG Shah13-Sep-07 21:28
GauranG Shah13-Sep-07 21:28 
AnswerRe: What is The difference in .DLL ???? Pin
Cedric Moonen13-Sep-07 21:54
Cedric Moonen13-Sep-07 21:54 
AnswerRe: What is The difference in .DLL ???? Pin
nbugalia13-Sep-07 22:00
nbugalia13-Sep-07 22:00 
QuestionSearch node in TreeView Pin
paresh_joe13-Sep-07 21:02
paresh_joe13-Sep-07 21:02 
AnswerRe: Search node in TreeView Pin
nbugalia13-Sep-07 21:23
nbugalia13-Sep-07 21:23 
AnswerRe: Search node in TreeView Pin
Nishad S13-Sep-07 21:28
Nishad S13-Sep-07 21:28 
GeneralRe: Search node in TreeView Pin
paresh_joe13-Sep-07 21:32
paresh_joe13-Sep-07 21:32 
QuestionConnection Error Pin
Programm3r13-Sep-07 20:37
Programm3r13-Sep-07 20:37 
AnswerRe: Connection Error Pin
p_13-Sep-07 23:35
p_13-Sep-07 23:35 
QuestionHow to get the byte order of a computer? Pin
kcynic13-Sep-07 20:01
kcynic13-Sep-07 20:01 
AnswerRe: How to get the byte order of a computer? Pin
Azteke13-Sep-07 20:06
Azteke13-Sep-07 20:06 
GeneralRe: How to get the byte order of a computer? Pin
kcynic13-Sep-07 22:23
kcynic13-Sep-07 22:23 

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.