winapi - C++ RegisterHotKey without overriding existing functionality -
when register hot key in c++ (the prtscn key in case), noticed original functionality lost. key not capture image of screen more. there way register hot key without breaking existing bindings?
the problem context: trying create application our testing team automate task of taking screenshots. when user clicks prtscn / alt+prtscn keys, want run small application picks image on clipboard , pushes document. of application in java, had come c++ registering hot key.
thanks help!!
this code used register hot key:
registerhotkey(null, 1, mod_alt | mod_norepeat, vk_snapshot); registerhotkey(null, 2, mod_norepeat, vk_snapshot); while (getmessage(&msg, null, 0, 0) != 0) { if (msg.message == wm_hotkey) { winexec(" java application ", sw_shownormal); } }
i don't think there's documented way trigger os's print screen functionality programmatically. have few ideas try:
- implement copy-to-clipboard functionality yourself, or
- once hotkey has been triggered, temporarily unregister hotkey , use
sendinput()
resend key press (this admittedly bit kludgy), or - drop hotkey method altogether , instead register clipboard viewer using
setclipboardviewer()
etc.
to me last idea seems best - you'll notified when clipboard contents change , it's easy see if format on clipboard image or not.
Comments
Post a Comment