Quelqu`un a-t-il deja realise un hook clavier sous Dev-C++?
Version imprimable
Quelqu`un a-t-il deja realise un hook clavier sous Dev-C++?
moi pas, mais regarde du cote des fonctions "kbhit()" (avec une boucle while) et "getch()".
dit nous plutot ton probleme et ceux qui sauront te repondre le feront. :wink:
voici mon progamme, fait avec ce que j`ai pu trouver sur internet:
qd je compile j`obtient:Code:
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 //****************************************************************************** #include <windows.h> //****************************************************************************** #define WH_KEYBOARD_LL 13 //****************************************************************************** #define DLLEXPORT _declspec(dllexport) #define DLLIMPORT _declspec(dllimport) //****************************************************************************** HINSTANCE moduleCourant; HHOOK hookClavier; //****************************************************************************** LRESULT CALLBACK InterceptionCommandesClavier (int nCode, WPARAM wParam, LPARAM lParam) { if(nCode == HC_ACTION) { KBDLLHOOKSTRUCT kbStruct = *((KBDLLHOOKSTRUCT *)lParam); switch(wParam) { case WM_KEYDOWN: if (kbStruct.vkCode == VK_LWIN || kbStruct.vkCode == VK_RWIN) return 1; // bloque touches windows if (kbStruct.vkCode == VK_ESCAPE && GetAsyncKeyState(VK_CONTROL)) return 1; // bloque control+echap if (kbStruct.vkCode == VK_MENU || kbStruct.vkCode == VK_TAB) return 1; // alt+tab if (kbStruct.vkCode == VK_MENU || kbStruct.vkCode == VK_F4) return 1; // alt+f4 } } return CallNextHookEx(hookClavier, nCode, wParam, lParam); } //****************************************************************************** void DLLEXPORT InitHook() { hookClavier = SetWindowsHookEx(WH_KEYBOARD_LL, InterceptionCommandesClavier, moduleCourant, 0); } //****************************************************************************** void DLLEXPORT ArreterHookClavier() { UnhookWindowsHookEx(hookClavier); } //****************************************************************************** BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID Reserved) { if (dwReason == DLL_PROCESS_ATTACH) { moduleCourant = hDll; } if (dwReason == DLL_PROCESS_DETACH) { ArreterHookClavier(); } return true; } //******************************************************************************
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
Qqun sait-il ce que ca veut dire?
:(
ca compile sans pb
g fe le con
:tagcode:
Tu avais créé un projet console au lieu d'un projet Win32 simple.
http://c.developpez.com/faq/cpp/?pag...S_console_vcpp
oui g vu :!:
enfin depuis neuf heures ce matin(10h chez vous je suis en angleterre)
que je fais des recherches sur les hook et que j`ai commence a programmer je commence a voir le bout du tunnel
malheuresement c toujours a cause d`une erreur a la con(et grosse en+)
que je cogite :?:
lol
:(