Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Segfaults with One container?
Next Topic: Add maximize and reduce to icon
Goto Forum:
  


Current Time: Wed May 29 05:45:14 CEST 2024

Total time taken to generate the page: 0.01720 seconds