winapi - Repeat message in Mouse Proc C++ Win32 -


i have procedure when user press ctrl button , right click show message box screen. has loop, press ctrl button , right click once time shows sequence of message box. how fix this? https://youtu.be/lzi9m_zeekq

this mouseproc procedure

    #define export __declspec(dllexport)     unsigned char  keystate[256];      lresult export callback mouseproc(int ncode, wparam wparam, lparam lparam)     {         if (ncode < 0)             return callnexthookex(hhook, ncode, wparam, lparam);         getkeyboardstate(keystate);          if (ncode == hc_action)         {             if ((wparam == wm_rbuttonup) && (keystate[vk_control] & 0x80))             {                 messagebox(null, l"ctrl + right click", l"mouse hook", mb_ok);             }         }         return callnexthookex(hhook, ncode, wparam, lparam);     } 

thanks reading.

you shall not use messagebox() in message hooks breaks normal message hook flow - messagebox() runs own modal loop.

if need messagebox there should use postmessage custom message , handler. in case messagebox invoked after callnexthookex(hhook, ncode, wparam, lparam);


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -