This should work (WNDPROC) gfnMyProc; //in some previous called function gfnMyProc = (WNDPROC)SetWindowLong(listview, GWL_WNDPROC,(LONG)MyProc); LRESULT CALLBACK MyProc(HWND hwnd, UINT uiMsg,WPARAM wParam, LPARAM lParam) { switch (uiMsg) { case WM_LBUTTONDOWN: { //your stuff here break; } } return CallWindowProc(gfnMyProc, hwnd, uiMsg, wParam, lParam); } Pain is a weakness living the body