Click here to Skip to main content
15,879,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhardware monitor Pin
gr8coaster32925-Feb-06 13:45
gr8coaster32925-Feb-06 13:45 
AnswerRe: hardware monitor Pin
Hamid_RT25-Feb-06 17:15
Hamid_RT25-Feb-06 17:15 
QuestionRe: hardware monitor Pin
gr8coaster32926-Feb-06 15:07
gr8coaster32926-Feb-06 15:07 
AnswerRe: hardware monitor Pin
Hamid_RT26-Feb-06 17:30
Hamid_RT26-Feb-06 17:30 
QuestionCEdit Default focus Pin
j_sharan25-Feb-06 12:28
j_sharan25-Feb-06 12:28 
AnswerRe: CEdit Default focus Pin
Hamid_RT25-Feb-06 17:07
Hamid_RT25-Feb-06 17:07 
AnswerRe: CEdit Default focus Pin
FarPointer26-Feb-06 3:58
FarPointer26-Feb-06 3:58 
QuestionCDialog and Keyboard events Pin
braveheartkenya25-Feb-06 11:15
braveheartkenya25-Feb-06 11:15 
I have dialog (window/form) that inherits from the CDialog class. This dialog has various controls on it including a few buttons and textboxes.

I am trying to get some keyboard events (key presses) to fire some events but its not working.

In the Header file for the dialog i have this as a protected declaration
[code]
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
[/code]

I have an ON_WM_KEYDOWN() event created and its corresponding method in the .cpp file
[code]
void COpenGLMFCDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
[/code]

Within this method i have written some test code to change the text in a textbox just to see whether the event is fired correctly, but the text is never changed. I also tried changing the dialog's name and also firing some Message Boxes ... but nothing worked.

The code in the "OnKeyDown" method is as follows:
[code]
void COpenGLMFCDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){

switch(nChar)
{
case VK_RETURN:
SetWindowText("You pressed Enter");
break;
case VK_F1:
SetWindowText("Help is not available at the moment");
break;
case VK_DELETE:
//SetWindowText("Can't Delete This");
//AfxMessageBox("Testing");
m_Txt_Test.SetWindowText("The Event was fired");
break;
case VK_DIVIDE:
//SetWindowText("Testing");
m_Txt_Test.SetWindowText("Another Event fired");
break;
default:
SetWindowText("Whatever");
}
}
[/code]

Could someone please (pretty please) tell me why this isn't working and whether i have done all that is needed for a keyboard event to fired & a result to be seen on screen.

Thanks in advance.
AnswerRe: CDialog and Keyboard events Pin
Hamid_RT25-Feb-06 17:04
Hamid_RT25-Feb-06 17:04 
GeneralRe: CDialog and Keyboard events Pin
braveheartkenya26-Feb-06 0:48
braveheartkenya26-Feb-06 0:48 
GeneralRe: CDialog and Keyboard events Pin
Hamid_RT26-Feb-06 3:49
Hamid_RT26-Feb-06 3:49 
GeneralRe: CDialog and Keyboard events Pin
braveheartkenya27-Feb-06 6:09
braveheartkenya27-Feb-06 6:09 
Questionloading a file into strings Pin
FARGORE25-Feb-06 11:13
FARGORE25-Feb-06 11:13 
QuestionMultithreading and ReadFile() / WriteFile() Pin
Halloko25-Feb-06 8:56
Halloko25-Feb-06 8:56 
AnswerRe: Multithreading and ReadFile() / WriteFile() Pin
FARGORE25-Feb-06 11:53
FARGORE25-Feb-06 11:53 
GeneralRe: Multithreading and ReadFile() / WriteFile() Pin
Halloko25-Feb-06 12:03
Halloko25-Feb-06 12:03 
AnswerRe: Multithreading and ReadFile() / WriteFile() Pin
cmk25-Feb-06 13:54
cmk25-Feb-06 13:54 
GeneralRe: Multithreading and ReadFile() / WriteFile() Pin
Halloko25-Feb-06 22:33
Halloko25-Feb-06 22:33 
GeneralRe: Multithreading and ReadFile() / WriteFile() Pin
ThatsAlok26-Feb-06 22:56
ThatsAlok26-Feb-06 22:56 
GeneralRe: Multithreading and ReadFile() / WriteFile() Pin
Halloko27-Feb-06 2:50
Halloko27-Feb-06 2:50 
QuestionData string Parsing Pin
srija25-Feb-06 8:24
srija25-Feb-06 8:24 
AnswerRe: Data string Parsing Pin
toxcct25-Feb-06 8:52
toxcct25-Feb-06 8:52 
GeneralRe: Data string Parsing Pin
srija28-Feb-06 0:16
srija28-Feb-06 0:16 
AnswerRe: Data string Parsing Pin
ThatsAlok26-Feb-06 22:51
ThatsAlok26-Feb-06 22:51 
QuestionGrid Control Pin
Tier525-Feb-06 8:08
Tier525-Feb-06 8:08 

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.