Click here to Skip to main content
15,919,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString or LPCTSTR...which one's better? Pin
rrrado13-Jun-03 2:07
rrrado13-Jun-03 2:07 
AnswerRe: CString or LPCTSTR...which one's better? Pin
TeeBee30313-Jun-03 2:10
TeeBee30313-Jun-03 2:10 
GeneralCEdit and the Return key Pin
CodeBrain13-Jun-03 1:42
CodeBrain13-Jun-03 1:42 
GeneralRe: CEdit and the Return key Pin
rrrado13-Jun-03 1:58
rrrado13-Jun-03 1:58 
GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 2:23
CodeBrain13-Jun-03 2:23 
GeneralRe: CEdit and the Return key Pin
Johann Gerell13-Jun-03 2:17
Johann Gerell13-Jun-03 2:17 
GeneralRe: CEdit and the Return key Pin
Roger Allen13-Jun-03 2:17
Roger Allen13-Jun-03 2:17 
GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 3:47
CodeBrain13-Jun-03 3:47 
I have added some additional code, which seems to work now. But I still find it a bit ugly to perform the check in the application class. But that's ugly windows Dead | X| Wink | ;)

Would be nice if someone could add feedback, if this code is correct or not, e.g. the
CWinApp::PreTranslateMessage(pMsg); part.

Thanks for your help!

BOOL CMyApp::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN))
{
HWND hFocus = GetFocus();
CFrameWnd* pFrmWnd = dynamic_cast<cframewnd*>(GetMainWnd()); if (pFrmWnd == NULL)
{
ASSERT(FALSE);
}

CWnd* pTarget = pFrmWnd->GetActiveView()->GetDlgItem(IDC_EDIT_X);
// We should test, if an active view exists, if we are not sure...
HWND hTarget = NULL;
if (pTarget != NULL)
{
hTarget = pTarget->GetSafeHwnd();
}
if (hFocus == hTarget)
{
// Do what you want
}
return 1;
}
else
{
return CWinApp::PreTranslateMessage(pMsg);
}
}
GeneralRe: CEdit and the Return key Pin
Ryan Binns13-Jun-03 4:05
Ryan Binns13-Jun-03 4:05 
GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 4:44
CodeBrain13-Jun-03 4:44 
QuestionHow do you prevent a window from being minimized? Pin
Abin13-Jun-03 1:21
Abin13-Jun-03 1:21 
AnswerRe: How do you prevent a window from being minimized? Pin
rrrado13-Jun-03 1:41
rrrado13-Jun-03 1:41 
GeneralRe: How do you prevent a window from being minimized? Pin
Abin13-Jun-03 1:44
Abin13-Jun-03 1:44 
QuestionHow to find active control ? Pin
rrrado13-Jun-03 0:31
rrrado13-Jun-03 0:31 
AnswerRe: How to find active control ? Pin
User 665813-Jun-03 1:20
User 665813-Jun-03 1:20 
GeneralRe: How to find active control ? Pin
rrrado13-Jun-03 1:39
rrrado13-Jun-03 1:39 
GeneralGetting Call Stack info Pin
Ceri13-Jun-03 0:09
Ceri13-Jun-03 0:09 
GeneralRe: Getting Call Stack info Pin
Neville Franks13-Jun-03 0:20
Neville Franks13-Jun-03 0:20 
GeneralRe: Getting Call Stack info Pin
Ceri13-Jun-03 0:53
Ceri13-Jun-03 0:53 
GeneralRe: Getting Call Stack info Pin
Neville Franks13-Jun-03 1:26
Neville Franks13-Jun-03 1:26 
GeneralRe: Getting Call Stack info Pin
Franz Klein13-Jun-03 2:28
Franz Klein13-Jun-03 2:28 
Generalblue screen Pin
fabio9712-Jun-03 23:56
fabio9712-Jun-03 23:56 
GeneralRe: blue screen Pin
Brian van der Beek13-Jun-03 0:19
Brian van der Beek13-Jun-03 0:19 
GeneralRe: blue screen Pin
fabio9713-Jun-03 0:35
fabio9713-Jun-03 0:35 
GeneralRe: blue screen Pin
Brian van der Beek13-Jun-03 0:42
Brian van der Beek13-Jun-03 0:42 

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.