OK, let's see how it works
Pretty cool, thanks!Code://HookDemo.cpp #include <windows.h> #include "WINUSER.H" /*--------------------------------------------- Shared Variables This data is shared between both prcesses. The VB App has access to these variables through the function SetSharedData ---------------------------------------------*/ #pragma data_seg(".shared") bool ChangeMessage = false; int Shared_uMsg = 0; int Shared_wParam = 0; int Shared_lParam = 0; HWND hWndVB = 0; //handle to subclassed VB Window HWND hWndCtrl = 0;//handle to the window we want to monitor #pragma data_seg() #pragma comment(linker, "/SECTION:.shared,RWS") //--------------------------------------------- // Global Variables, specific to each process //--------------------------------------------- HHOOK hmsgHooks = 0; // Hook handle for WH_GETMESSAGE HINSTANCE hInstance; // Global instance handle for DLL //-------------------------------------------- // DLL entry-point //-------------------------------------------- BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function LPVOID lpvReserved ) // reserved { // Perform actions based on the reason for calling. switch( fdwReason ) { case DLL_PROCESS_ATTACH: // Initialize once for each new process. // Return FALSE to fail DLL load. hInstance = hinstDLL;//save dll handle for each process break; case DLL_THREAD_ATTACH: // Do thread-specific initialization. break; case DLL_THREAD_DETACH: // Do thread-specific cleanup. break; case DLL_PROCESS_DETACH: // Perform any necessary cleanup. break; } return TRUE; // Successful DLL_PROCESS_ATTACH. }




Reply With Quote