DLL won't phone home?
-
I have a hook dLL that I'd like to send a message back to the calling app. Something like...... keyboard hook detects that F2 is pressed dLL sends message to app app shows dialog main code in dLL as follows /////////////////////////////////////////////////////////// #define WM_APPSTARTED WM_USER + 100 #pragma data_seg(".shared") HWND g_mainWnd = NULL; //the server window handle HHOOK g_hShellHook = NULL; HHOOK g_hKeyboard = NULL; #pragma data_seg() #pragma comment(linker, "section:.shared,rws") SYSDLL_API BOOL _Startup(HWND hwnd) { g_hKeyboard = NULL; g_mainWnd = hwnd; // g_mainWnd is the main window handle g_hKeyboard = SetWindowsHookEx(WH_KEYBOARD, MyProc, g_hInstance, 0); if(g_hKeyboard == NULL) MessageBox(HWND_DESKTOP, "hook fail", "BLAH", MB_OK); if(g_mainWnd != NULL) return FALSE; // already hooked! g_hShellHook = SetWindowsHookEx(WH_SHELL, MyShellProc,g_hInstance, 0); if(g_hShellHook != NULL) { g_mainWnd = hwnd; return TRUE; } return FALSE; } SYSDLL_API LRESULT CALLBACK MyShellProc(int ncode, WPARAM wparam, LPARAM lparam) { if(ncode < 0 ) return CallNextHookEx(g_hShellHook, ncode, wparam, lparam); if(ncode == HSHELL_WINDOWCREATED) { HWND hfoundApp; hfoundApp = FindWindow(NULL, TEXT("my_window" ) ); if(hfoundApp) { PostMessage(hfoundApp, WM_APPSTARTED, lparam, wparam); } } this is where I'd like the dLL to send a message to the callin app but the message never gets to the app thanks for your time :confused: