Home » U++ Library support » U++ Library : Other (not classified elsewhere) » How to set a global (system) keyboard hook?
Re: How to set a global (system) keyboard hook? [message #23230 is a reply to message #23199] |
Thu, 01 October 2009 14:11 |
|
Hello Mirek!
I found the interesting situation about Global Hotekey:
I want to register global hotkey for Ctrl+C+C and get from clickboard copied data.
I did so:
1. Register system hotkey Ctrl+C
TranslateHotKeyId = Ctrl::RegisterSystemHotKey(K_CTRL_C, THISBACK(GlobalShortCutHandle));
2. in my callback I wrote:
void GoogleTranslatorDemo::GlobalShortCutHandle(){
if(!AtomicRead(test_test)){
AtomicWrite(test_test,1);
bool need_translate = false;
if(shortcut_stage==0){
shortcut_stage = 1; // first Ctrl+C
time_stop_shortcut.Reset();
}
else if (time_stop_shortcut.Elapsed()<600){
need_translate = true;
shortcut_stage = 0;
}
else {
shortcut_stage = 1; // first Ctrl+C
time_stop_shortcut.Reset();
}
if(need_translate){
WString cur_text = ReadClipboardUnicodeText();
if(cur_text.GetLength()){
inputwindow.textedit.Set(cur_text);
TranslateTextInBaloon();
}
}
AtomicWrite(test_test,0);
}
}
On the second press Ctrl+C start translating.
The problem:
When I press Ctrl+C from the other application the standard command (copy text) do not react. In other words did not coping the selected text.
How can I do this?
[Updated on: Thu, 01 October 2009 14:12] Report message to a moderator
|
|
|
|
|
How to set a global (system) keyboard hook?
By: midra on Fri, 18 September 2009 00:37
|
|
|
Re: How to set a global (system) keyboard hook?
By: mirek on Fri, 18 September 2009 05:55
|
|
|
Re: How to set a global (system) keyboard hook?
By: tojocky on Fri, 18 September 2009 08:01
|
|
|
Re: How to set a global (system) keyboard hook?
By: tojocky on Fri, 18 September 2009 16:03
|
|
|
Re: How to set a global (system) keyboard hook?
By: mirek on Sun, 20 September 2009 09:18
|
|
|
Re: How to set a global (system) keyboard hook?
By: mirek on Thu, 24 September 2009 23:05
|
|
|
Re: How to set a global (system) keyboard hook?
By: tojocky on Fri, 25 September 2009 09:55
|
|
|
Re: How to set a global (system) keyboard hook?
By: cocob on Fri, 25 September 2009 11:21
|
|
|
Re: How to set a global (system) keyboard hook?
By: tojocky on Thu, 01 October 2009 14:11
|
|
|
Re: How to set a global (system) keyboard hook?
By: mirek on Thu, 01 October 2009 20:55
|
|
|
Re: How to set a global (system) keyboard hook?
By: tojocky on Fri, 02 October 2009 08:03
|
|
|
Re: How to set a global (system) keyboard hook?
By: mirek on Fri, 02 October 2009 10:06
|
Goto Forum:
Current Time: Wed May 29 05:45:14 CEST 2024
Total time taken to generate the page: 0.01720 seconds
|