Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All:

I would like to do a program which could execute like a OSD(On Screen Display).

Now I have known how to do a program that can retrieve the key_event by PreTranslateMessage(), and I post it underneath:
C++
BOOL CkeyboardDlg::PreTranslateMessage(MSG* pMsg) //pMsg: Points to a MSG structure that contains the message to process.
{

    if  (WM_KEYDOWN  ==  pMsg->message)  
    {  

        if  (VK_F10 ==  pMsg->wParam)  
        { 
			MessageBox(_T("You press the F10!"),MB_OK);
            return 0; 
        } 
    }
    return CDialog::PreTranslateMessage(pMsg);
}

But the problem is the activity ('F10 button') respond only when I let the program on the top of my desktop.
On the other hand, it can't be used if the program is minimum...

I wonder whether the MFC can do a program like the OSD that could retrieve the keyboard event anytime (the program don't need to execute on the top).

Thanks for your help!!
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900