1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
LRESULT CALLBACK fonctionIntercepteClavier (int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode >= 0)
{
if( (GetKeyState(wParam)& 128) != 0 && wParam == VK_SPACE) // si key down et espace
{
handleApplic = FindWindow(NULL,"Attraction"); // recupere handle de mon applic
c = nomModule + GetModuleFileName(0, nomModule, 264);
while(*c != '\\')
c--;
if(stricmp(c+1, "WINWORD.EXE") == 0) // si word
{
handlePlayer = GetFocus(); // recup handle sur word
SendMessage(handleApplic,WM_SETFOCUS,0,0); // affiche mon applic (ca marche)
return 1;
}
if(stricmp(c+1, "Mon Applic.EXE") == 0) // si mon applic (je sais que je rentre dedans mais ne change pas le focus :-(
{
SendMessage(handlePlayer,WM_SETFOCUS ,0,0); // affiche word (marche po)
return 1;
}
}
return CallNextHookEx(hookClavier, nCode, wParam, lParam); //return 1 pour empecher le traitement des touches, sinon retourner CallNextHookEx(...)
}
return CallNextHookEx(hookClavier, nCode, wParam, lParam);
} |
Partager