C
chris kramer
i have an application that allows you to Select some text in a window,
but no option to Copy it to the clipboard (nor does Ctrl-C or
Shift-insert work, or right click etc..) i want to get these values
somehow.
below is the best posted method i have found online.
if anyone can elaborate, as to how to implement such message passing
(as a novice) i would be thrilled. i am using and old visual c++ 4
compiler with
an example program that simply creates instances of notepad-like
windows.
(to test the idea)
i can't find examples on how to implement message handling at the
simplest level. specifically what/where do i insert into a message
map, and where does the code go that 'listens' for this change in
window focus. (or will the below idea even work)
thanks.
chris
"
Assuming that you can get the window handle of the edit control
you are concerned with, I would think that all you need to do is
send a WM_COPY message to that control. That slaps the selected
text onto the clipboard:
SendMessage(hwndEdit,WM_COPY,0,0L);
You should be able to get the edit control's handle by calling
GetFocus() to see which window has the keyboard focus when your
button on the titlebar is pushed. I can see the problem with
this, though...when your application is activated by a button
push, YOUR app will have keyboard focus. To get around this,
you can process the WM_SETFOCUS message in your app to see which
window you are taking the focus FROM. This should be the edit
control with the selected text.
"
but no option to Copy it to the clipboard (nor does Ctrl-C or
Shift-insert work, or right click etc..) i want to get these values
somehow.
below is the best posted method i have found online.
if anyone can elaborate, as to how to implement such message passing
(as a novice) i would be thrilled. i am using and old visual c++ 4
compiler with
an example program that simply creates instances of notepad-like
windows.
(to test the idea)
i can't find examples on how to implement message handling at the
simplest level. specifically what/where do i insert into a message
map, and where does the code go that 'listens' for this change in
window focus. (or will the below idea even work)
thanks.
chris
"
Assuming that you can get the window handle of the edit control
you are concerned with, I would think that all you need to do is
send a WM_COPY message to that control. That slaps the selected
text onto the clipboard:
SendMessage(hwndEdit,WM_COPY,0,0L);
You should be able to get the edit control's handle by calling
GetFocus() to see which window has the keyboard focus when your
button on the titlebar is pushed. I can see the problem with
this, though...when your application is activated by a button
push, YOUR app will have keyboard focus. To get around this,
you can process the WM_SETFOCUS message in your app to see which
window you are taking the focus FROM. This should be the edit
control with the selected text.
"