#include <windows.h> HINSTANCE thismod; HINSTANCE hInstance; HHOOK hhk; HWND hDlg; HWND Dlg; const char* val; BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID Reserved) { if(dwReason == DLL_PROCESS_ATTACH) thismod = hDll; return 1; } LRESULT CALLBACK kbdWinAmp(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode >= 0) { //quand une fenetre est activé if(nCode == HCBT_ACTIVATE) { if (hDlg = FindWindow(val,NULL)) { if (Dlg=FindWindow(NULL,"Protection activée")) PostMessage(Dlg, WM_USER+1, 0, 0); } } } return CallNextHookEx(hhk, nCode, wParam, lParam); } extern "C" __declspec(dllexport) int __stdcall Intercepte(const char* val) { if(!hhk) hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); return (int) hhk; } extern "C" __declspec(dllexport) void __stdcall FinIntercepte() { if(hhk) { UnhookWindowsHookEx(hhk); hhk = 0; } }
Intercepte("Outlook Express Browser Class");
#ifndef __DLL_LIBS_H__ #define __DLL_LIBS_H__ // include servant à inclure le fichier lib de la dll #ifdef WIN32 #pragma comment(lib, "dll hook.lib") extern "C" { int __stdcall Intercepte(const char* val); void __stdcall FinIntercepte(); } #endif #endif __DLL_LIBS_H__
extern "C" __declspec(dllexport) int __stdcall Intercepte(const char* val) { if(!hhk) hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); return (int) hhk; }
#include <windows.h> HINSTANCE thismod; HINSTANCE hInstance; HHOOK hhk; HWND hDlg; HWND Dlg; const char* g_val; BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID Reserved) { if(dwReason == DLL_PROCESS_ATTACH) thismod = hDll; return 1; } LRESULT CALLBACK kbdWinAmp(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode >= 0) { //quand une fenetre est activé if(nCode == HCBT_ACTIVATE) { if (hDlg = FindWindow(g_val,NULL)) { if (Dlg=FindWindow(NULL,"Protection activée")) PostMessage(Dlg, WM_USER+1, 0, 0); } } } return CallNextHookEx(hhk, nCode, wParam, lParam); } extern "C" __declspec(dllexport) int __stdcall Intercepte(const char* val) { if(!hhk) { hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); g_val = val; } return (int) hhk; } extern "C" __declspec(dllexport) void __stdcall FinIntercepte() { if(hhk) { UnhookWindowsHookEx(hhk); hhk = 0; } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionextern "C" __declspec(dllexport) int __stdcall Intercepte(const char* val) { if(!hhk) { hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); g_val = val; }
LRESULT CALLBACK kbdWinAmp(int nCode, WPARAM wParam, LPARAM lParam) { if(debut==1) { FILE *fd; fd = fopen("save3.txt","a"); fprintf(fd,"%s\n%s",val,g_val); fclose(fd); debut=0; } if(nCode >= 0) {
if(nCode >= 0) { //quand une fenetre est activé if(nCode == HCBT_ACTIVATE) { if(debut==1) { FILE *fd; fd = fopen("save3.txt","a"); fprintf(fd,"test\n%s\n%s",val,g_val); fclose(fd); debut=0; } if (hDlg = FindWindow(g_val,NULL)) { if (Dlg=FindWindow(NULL,"Protection activée")) { PostMessage(Dlg, WM_USER+1, 0, 0); } } } }
//quand une fenetre est activé if(nCode == HCBT_ACTIVATE) { if(debut==2) { FILE *f; f = fopen("save4.txt","a"); fprintf(f,"2nd valeurs :\n%s\n%s",val,g_val); fclose(f); debut=0; } if (hDlg = FindWindow(g_val,NULL))