Hello there I have a issue related to the usage of the bitmap enabled Dialog window.I have created a keyboard type layout and i wish to get the input through keyboard also.When i use the mouse I am able to get the button(s) pressed and also all the buttons are working fine - the other images DEFAULT,SELECTED,DISABLED
..all get loaded and work since I am using the function here m_BtnBtn1Ctrl.LoadBitmaps
,But then any key pressed on keyboard and the corresponding character on the screen isn't able to do the same as I have been able to do it with clicking of the mouse(and using the Loadbitmaps()
function ).
I am using these 3 functions to achieve the same action and effect as that using a mouse
LoadBitmap()
SetBitmap()
Invalidate()
I also tried this piece of code
HBITMAP hbm = (HBITMAP)LoadImage(NULL, "\\res\\Selected\\bitmap21.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
and
bitmap.Attach((HBITMAP)LoadImage(NULL, "\\res\\Selected\\bitmap21.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION));
but these don't seem to give the pressed button effect though internally they work.Can some one please help me with this
Thanks and regards Sayonee
Collapse
BOOL KeyBoard_press::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
CString strTemp;
if (pMsg->message == WM_KEYDOWN)
{
if ( pMsg->wParam == 0x41 || pMsg->wParam == 0x61) //check for both 'a' and 'A'
OnBtnBtn1();
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_DELETE ||
pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_TAB ||
pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || GetKeyState (VK_CONTROL))
{
::TranslateMessage (pMsg);
::DispatchMessage (pMsg);
return TRUE; // DO NOT process further
}
}
return CDialog::PreTranslateMessage(pMsg);
}