Hook clavier sous windows

gamani5 Messages postés 2 Date d'inscription samedi 13 mars 2004 Statut Membre Dernière intervention 7 avril 2006 - 7 avril 2006 à 17:09
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 7 avril 2006 à 18:28
slt

je sais il y a deja beaucoup de tuto sur le sujet mais j en ai lu plein mais j ai toujours un probleme, j arrive a detecter l utilisation d une touche mais je n' arrive pas a empecher son execution:

exemple pour la touche windows

LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam, LPARAM lParam)
{


if (wParam VK_LWIN || wParam VK_RWIN)
{
// MessageBox(0, "touche windowws appuyée", "Hook détection", MB_OK);
return 1;
}

CallNextHookEx(NULL, code, wParam, lParam);
return(r);
}

voila j espere que vous pourrez m aider a+

3 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
7 avril 2006 à 17:49
LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam, LPARAM lParam)
{
if(code >= 0) { // SINON NE PAS TOUCHER !!! if(wParam VK_LWIN || wParam VK_RWIN) return 1;
}
return CallNextHookEx(hhook, code, wParam, lParam);
}

ciao...
BruNews, MVP VC++
0
gamani5 Messages postés 2 Date d'inscription samedi 13 mars 2004 Statut Membre Dernière intervention 7 avril 2006
7 avril 2006 à 18:15
desolé mais j'ai pas de variable hhook , tu l'initialise ou ?
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
7 avril 2006 à 18:28
hhook = SetWindowsHookEx(...);

Tu comptais hooker sans cet appel ???

ciao...
BruNews, MVP VC++
0
Rejoignez-nous