Click here to Skip to main content
15,914,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CListBox problem... Pin
David Crow20-May-04 9:20
David Crow20-May-04 9:20 
GeneralRe: CListBox problem... Pin
Mirelutza20-May-04 10:28
Mirelutza20-May-04 10:28 
GeneralRe: CListBox problem... Pin
*Dreamz20-May-04 18:38
*Dreamz20-May-04 18:38 
GeneralRe: CListBox problem... Pin
Mirelutza20-May-04 21:16
Mirelutza20-May-04 21:16 
GeneralRe: CListBox problem... Pin
Mirelutza20-May-04 21:44
Mirelutza20-May-04 21:44 
GeneralCatch Return Key in CListBox Pin
aturki20-May-04 5:39
aturki20-May-04 5:39 
GeneralRe: Catch Return Key in CListBox Pin
Iain Clarke, Warrior Programmer20-May-04 5:59
Iain Clarke, Warrior Programmer20-May-04 5:59 
GeneralRe: Catch Return Key in CListBox Pin
Andrew Quinn AUS20-May-04 6:06
Andrew Quinn AUS20-May-04 6:06 
Hi there,

You could use PreTranslateMessage, e.g.

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg) 
{
	BOOL bEatMsg = FALSE;

	if (pMsg && pMsg->message == WM_KEYDOWN)
	{
		// is this our listbox?
		if (pMsg->hwnd == m_ctrlListBox.GetSafeHwnd())
		{
			// yes.. what was the key pressed?
			switch (pMsg->wParam)
			{
			case 13: // Enter
				// Do what you need to do...
				bEatMsg = TRUE;
				break;
			}
		}
	}

	return bEatMsg?TRUE:CDialog::PreTranslateMessage(pMsg);
}


Here's the function declaration:

public:
virtual BOOL PreTranslateMessage(MSG* pMsg);


Remember to put the declaration in your AFX_VIRTUAL(CMyDlg) macros so as not to confuse ClassWizard

Hope this helps,
Andy
GeneralUse pipe without WriteFile Func Pin
Anonymous20-May-04 5:39
Anonymous20-May-04 5:39 
GeneralRe: Use pipe without WriteFile Func Pin
valikac20-May-04 6:10
valikac20-May-04 6:10 
GeneralRe: Use pipe without WriteFile Func Pin
Member 42102520-May-04 6:32
Member 42102520-May-04 6:32 
GeneralLong Wait for a Mutex Pin
sweep12320-May-04 5:27
sweep12320-May-04 5:27 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:14
valikac20-May-04 6:14 
GeneralRe: Long Wait for a Mutex Pin
sweep12320-May-04 6:21
sweep12320-May-04 6:21 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:31
valikac20-May-04 6:31 
GeneralRe: Long Wait for a Mutex Pin
sweep12320-May-04 6:36
sweep12320-May-04 6:36 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:45
valikac20-May-04 6:45 
GeneralRe: Long Wait for a Mutex Pin
Grahamfff20-May-04 10:18
Grahamfff20-May-04 10:18 
GeneralRe: Long Wait for a Mutex Pin
Paul Ranson20-May-04 10:34
Paul Ranson20-May-04 10:34 
GeneralRe: Long Wait for a Mutex Pin
Grahamfff20-May-04 10:45
Grahamfff20-May-04 10:45 
GeneralRe: Long Wait for a Mutex Pin
Paul Ranson20-May-04 11:34
Paul Ranson20-May-04 11:34 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 11:24
valikac20-May-04 11:24 
GeneralBitwise Left Shift Pin
Anthony988720-May-04 5:08
Anthony988720-May-04 5:08 
GeneralRe: Bitwise Left Shift Pin
Michael Dunn20-May-04 5:13
sitebuilderMichael Dunn20-May-04 5:13 
GeneralRe: Bitwise Left Shift Pin
Antony M Kancidrowski20-May-04 5:26
Antony M Kancidrowski20-May-04 5:26 

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.