Bonjour,
j'ais chercher un moyen de récupérer le message wm_close de la fenêtre active.
Après avoir parlez avec BruNews, j'ai compris qu'il me falait faire une dll.
Comme je ne savais pas fair de dll, j'ais apris enfin presque. ^^
Mais voila elle ne fonctionne pas pouvez - vous m'aidez svp.
La source Cpp :
#include "Custom.h"
#include <windows.h>
#define NEXTZERO (WM_USER+20)
#pragma data_seg("Shared")
HWND hWnd = 0;
HHOOK hhk;
#pragma data_seg()
#pragma comment(linker, "/section:Shared,rws")
HINSTANCE hInst;
BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID Reserved)
{
if(dwReason == DLL_PROCESS_ATTACH) hInst = hDll;
return 1;
}
LRESULT CALLBACK VerifIE(int nCode, WPARAM wParam, LPARAM lParam) {
if(nCode == HSHELL_WINDOWDESTROYED) {
MessageBox(NULL,"","",MB_OK);
}
return CallNextHookEx(hhk, nCode, wParam, lParam);
}
DLLIMPORT int Intercepte()
{
if(!hhk) hhk = SetWindowsHookEx(WH_SHELL, VerifIE, hInst, 0);
return (int) hhk;
}
DLLIMPORT void Relache()
{
if(hhk) {UnhookWindowsHookEx(hhk); hhk = 0;}
}
La source h :
#ifndef _CUSTOM_H_
#define _CUSTOM_H_
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
DLLIMPORT int Intercepte();
DLLIMPORT void Relache();
#endif /* _DLL_H_ */
Dev-Cpp compile.
Quand je crée un prog qui utilise Intercepte(), le prog fonctionne, mais le messageBox n'est jamais envoyé et ça même à la fermeture du prog.
Pour quoi ?