Re: PostMessage() Inquiry
CWnd *pWnd = CWnd::GetActiveWindow();
pWnd->PostMessage(WM_PASTE,(WPARAM)0,(LPARAM)0);
let me know if you find problems with that.
Re: PostMessage() Inquiry
The PostMessage() that you filled out for me helps me greatly. However, I still have a problem. The active window at the time that the hotkey is pressed is my application, so I need to somehow know (or get a handle) to the window (say notepad for example) and then paste the statistics so that when the user pressed the hotkey in my application, it will insert the text into the clipboard, and then send a PASTE message to the notepad window for example..
Does that explain things a little better? Do you have any other thoughts?
Thanks!
- Troy
Re: PostMessage() Inquiry
If the process of your application is
different from the process of target window,
then you need to set a systemwide hook
for keyboard messages.
The hook function is called before a keyboard
message is sent to target application.
You can modify the message in the hook
procedure if the message is meant to the
application that you are looking for.
Then the modified message goes to the
appropriate application.
I dont remember the exact syntax offhand,but
you need to do something like this :
1. Write a keyboard hook function
Refer Win32 API documentation for the
exact function signature.
Systemwide hook procedure must
reside in a DLL.
2. Set the systemwide hook by calling
SetWindowsHookEx() call.
Use KEYBOARD hook.
Let me know if it works for you.
shridhar.
Re: PostMessage() Inquiry
Thanks for the information, I'll try that and see what I come up with! :)
- Troy
Re: PostMessage() Inquiry
Actually, I found a quite clever way to handle this. Instead of using a system wide keyboard hook, I posted a WM_KEYDOWN message using the keyboard input buffer. That accomplished what I wanted exactly, without the extra DLL to worry about!
- Troy