Click here to Skip to main content
14,667,427 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ios::in | ios::out error Pin
Sujan Dhakal2-Feb-10 9:46
MemberSujan Dhakal2-Feb-10 9:46 
AnswerRe: ios::in | ios::out error Pin
David Crow2-Feb-10 9:51
MemberDavid Crow2-Feb-10 9:51 
GeneralRe: ios::in | ios::out error Pin
Sujan Dhakal2-Feb-10 16:27
MemberSujan Dhakal2-Feb-10 16:27 
GeneralRe: ios::in | ios::out error Pin
CPallini2-Feb-10 21:16
mveCPallini2-Feb-10 21:16 
GeneralRe: ios::in | ios::out error Pin
Sujan Dhakal3-Feb-10 0:55
MemberSujan Dhakal3-Feb-10 0:55 
GeneralRe: ios::in | ios::out error Pin
CPallini3-Feb-10 1:30
mveCPallini3-Feb-10 1:30 
AnswerRe: ios::in | ios::out error Pin
xiaozhu87662-Feb-10 17:07
Memberxiaozhu87662-Feb-10 17:07 
QuestionCDialog ON_WM_KEYDOWN event Pin
chevu2-Feb-10 0:20
Memberchevu2-Feb-10 0:20 
Hi,
I am using ON_WM_KEYDOWN event for keyboard shortcuts in my application. And below is function to handle this keydown action.

void CRearPanel::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if(nChar == 112)
	{
		if(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd != NULL)
			((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->ShowWindow(SW_HIDE);
		if(((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->m_hWnd != NULL)
			((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->ShowWindow(SW_HIDE);
	}
	else if(nChar == 113)
	{
		((CMainFrame*)AfxGetMainWnd())->OnViewHWSimulator();		

		if(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd != NULL)
			((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->ShowWindow(SW_HIDE);
	}
	else if(nChar == 114)
	{
		((CMainFrame*)AfxGetMainWnd())->OnViewRearpanel();
		::SetFocus(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd);

		if(((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->m_hWnd != NULL)
			((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->ShowWindow(SW_HIDE);
	}

	CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

Now let me explain my problem,

Here I am having one main document window which is coming up initially. And I have another 2 dialog window which should be open on keydown event. From main document window I am able to get key down event and functionality working properly. In Those 2 dialog I put same events, and there start my problem. First time when it(dialog) comes up its not catching keydown event. If I close that dialog and then open it again then I am able to catch it. I found on net some where to put below code,

BOOL CRearPanel::PreTranslateMessage(MSG* pMsg) 
{	
	if( pMsg->message == WM_KEYDOWN )	
	{			
		::TranslateMessage(pMsg);
		::DispatchMessage(pMsg);
		return (1);
	}	
	return CDialog::PreTranslateMessage(pMsg);
}


But I dint find it helpful. Can any one help me for this issue.
QuestionRe: CDialog ON_WM_KEYDOWN event Pin
Nelek2-Feb-10 5:54
protectorNelek2-Feb-10 5:54 
GeneralRe: CDialog ON_WM_KEYDOWN event [modified] Pin
chevu2-Feb-10 15:02
Memberchevu2-Feb-10 15:02 
GeneralRe: CDialog ON_WM_KEYDOWN event Pin
chevu2-Feb-10 21:17
Memberchevu2-Feb-10 21:17 
AnswerRe: CDialog ON_WM_KEYDOWN event Pin
chevu2-Feb-10 23:31
Memberchevu2-Feb-10 23:31 
GeneralRe: CDialog ON_WM_KEYDOWN event Pin
Nelek3-Feb-10 20:36
protectorNelek3-Feb-10 20:36 
Questionhow to download google apis Pin
anshach1-Feb-10 22:45
Memberanshach1-Feb-10 22:45 
AnswerRepost - please ignore. Pin
CPallini1-Feb-10 23:11
mveCPallini1-Feb-10 23:11 
AnswerRe: how to download google apis Pin
Game-point2-Feb-10 0:02
MemberGame-point2-Feb-10 0:02 
GeneralRe: how to download google apis PinPopular
David Crow2-Feb-10 3:23
MemberDavid Crow2-Feb-10 3:23 
AnswerRe: how to download google apis Pin
Nelek2-Feb-10 5:59
protectorNelek2-Feb-10 5:59 
QuestionWhere Export data section reside in PE? [modified] Pin
glitteringsound1-Feb-10 21:33
Memberglitteringsound1-Feb-10 21:33 
AnswerRe: Where Export data section reside in PE? Pin
Richard MacCutchan1-Feb-10 23:28
mveRichard MacCutchan1-Feb-10 23:28 
AnswerRe: Where Export data section reside in PE? Pin
Stuart Dootson2-Feb-10 1:06
professionalStuart Dootson2-Feb-10 1:06 
Questionwhat does c++ class allocate in memory image. Pin
aiming04201-Feb-10 21:16
Memberaiming04201-Feb-10 21:16 
AnswerRe: what does c++ class allocate in memory image. Pin
KingsGambit1-Feb-10 21:21
MemberKingsGambit1-Feb-10 21:21 
GeneralRe: what does c++ class allocate in memory image. Pin
aiming04201-Feb-10 22:14
Memberaiming04201-Feb-10 22:14 
QuestionWhat Relative Virtual Addressing is and the whole story behinds it ? Pin
glitteringsound1-Feb-10 21:01
Memberglitteringsound1-Feb-10 21:01 

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.