On Sat, Jan 15, 2011 at 4:30 PM, Winston Pang <[email protected]> wrote:
> Hey,
>
> Thanks for your reply, yep looks like the solution I found online
> isn't doing it, I'll try and add it in.
>
> But my main question really is, how do I make all applications
> initiate a Copy with my system wide key hook?

Ah, right, I understand.


> So when you're in word, you do Ctrl + Shift + C, and it will copy the
> selected text and then my application will receive this hot key
> message and I can read the clipboard.

Just looking into this a bit, it seems to me (and I could definitely
be wrong) that the keyboard hook you install won't tell you which
application the event was sent to. So, you'll need to guess based on
which one has focus, I suppose, when your hook event is hit. This
doesn't seem "ideal" to me, and maybe I'm wrong.

Assuming that is the case, though, (and even if it wasn't; i.e. even
if you got a handle to the app); you'll need to probably just do a
Win32 SendMessage, perhaps, say, of WM_COPY[1]. But, this may not work
universally. Maybe there is a universal way to send "copy" (other then
simulating control-c, which is obviously strictly "bad"), meski may
know but I don't :P

So, I have no idea what you're trying to do in general, but perhaps it
would be more "stable" if you just hooked into the current control-c
event chain. However, I don't know what order that chain is executed
in (i.e. you may be first, and nothing is in there yet because the
Word app, or whatever, has not copied the text yet), so even that may
be problematic.

Sorry I don't have any real advice here. I did stumble across this,
which may be of interest (or you've maybe already seen it):
 <http://msdn.microsoft.com/en-au/magazine/cc188966.aspx#S4>

I'd be interested to know how you solve this.


> Thanks again for your help and everyone else.
>
> --Winston

-- 
[1] http://msdn.microsoft.com/en-us/library/ms649022%28VS.85%29.aspx


Noon Silk

http://dnoondt.wordpress.com/  (Noon Silk) | http://www.mirios.com.au:8081 >

"Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature."

Reply via email to