minifiredragon
Programmer
First off, I am farely new to C++ programming. Now, for my problem. I am developing a small application that requires no user intereaction (no keyboard or mouse), But I want to run some tests to emulate the hardware before I shell out $3000 on the needed equipment. The program accesses a database and keeps track of user information. I created an SDI application with support for database and winsock. Now I start writing my code and controls and I run into this teeny tiny problem. In the view class, I set an WM_KEYDOWN command and have it check if it was the letter "I". When I compile the code and press I, it does a system ding. I get the same response for all the keys. What in the world have I done wrong?? I used the Classwizard to add my WM_KEYDOWN event by right clicking on my opening window (which is a view class). Here is the chunk of code.
void CICServerView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
char lsChar; //Character being pressed
HCURSOR lhCursor;
//Convert key pressed to character
lsChar = char(nChar);
//Is Keypress "I"?
if (lsChar == 'I'){
lhCursor = AfxGetApp()->LoadStandardCursor(IDC_WAIT);
//Initialize InsertDlg window
CInsertDlg dlgInsertDlg;
//OPen Window
dlgInsertDlg.DoModal();
}
CRecordView::OnKeyDown(nChar, nRepCnt, nFlags);
}
It was suppose to open up a dailog box, but I thought maybe I didn't set up the dialog box right. So I set it to change the cursor. It doesn't work, and it compiles and opens up just fine.
Any one experience this before??
Thanks for any help.
void CICServerView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
char lsChar; //Character being pressed
HCURSOR lhCursor;
//Convert key pressed to character
lsChar = char(nChar);
//Is Keypress "I"?
if (lsChar == 'I'){
lhCursor = AfxGetApp()->LoadStandardCursor(IDC_WAIT);
//Initialize InsertDlg window
CInsertDlg dlgInsertDlg;
//OPen Window
dlgInsertDlg.DoModal();
}
CRecordView::OnKeyDown(nChar, nRepCnt, nFlags);
}
It was suppose to open up a dailog box, but I thought maybe I didn't set up the dialog box right. So I set it to change the cursor. It doesn't work, and it compiles and opens up just fine.
Any one experience this before??
Thanks for any help.