thank you for the usefull links, and this is my first try: this is my callback function LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode<0) return CallNextHookEx(0,nCode,wParam,lParam); if (wParam == WM_RBUTTONDOWN) { MessageBox(GetForegroundWindow(), "Yes", "Works", MB_OK); } return CallNextHookEx(0,nCode,wParam,lParam); } and in onbutton function I set: HOOKPROC wlm; HHOOK check; HINSTANCE WLMDLL; WLMDLL = LoadLibrary((LPCTSTR) "MyHook.dll"); wlm = (HOOKPROC)GetProcAddress(WLMDLL, "MouseProc"); check = SetWindowsHookEx(WH_MOUSE,wlm,WLMDLL,0); as you can see I am trying to do a mouse hook, this try is to get any right click, but later when I get it to work, I want it to be for a defined application that when it gets right click the the popup pops up can you see what I am doing wrong in my code? thanks in advance! |) () |) '/