Connecting Tech Pros Worldwide Forums | Help | Site Map

copying window text....please help! this language is insane.

chris kramer
Guest
 
Posts: n/a
#1: Jul 22 '05
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.
"

John Harrison
Guest
 
Posts: n/a
#2: Jul 22 '05

re: copying window text....please help! this language is insane.



"chris kramer" <zewkini8@yahoo.com> wrote in message
news:8861ab66.0401232320.1ed51d9f@posting.google.c om...[color=blue]
> 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.
>[/color]

What language? You are talking about Win32 API programming not C++. You
would face exactly the same issue if you were using another language like
Pascal or assembly.

Please take this question to a group where is it relevant, like
comp.os.ms-windows.programmer.win32. Your question has no C++ content.

[snip]

John


chris kramer
Guest
 
Posts: n/a
#3: Jul 22 '05

re: copying window text....please help! this language is insane.


john - you are right..
was overwhelmed and slightly drunk when i gave up and made a plea for
help :)
i have gotten closer - i can shut down a window in VB using WM_CLOSE
message.
(i gave up on using visual c++, it is absurdly complex)
WM_COPY doesn't seem to work though. If anyone knows anyone that can
get highlighted text from another window that won't allow direct
copying, i'd love to know how. (zewkini8@yahoo.com)
sorry about posting to the wrong place.. thank god Visual C++ is not
something the world accepts as a standard. i think it is a complete
nightmare.
Victor Bazarov
Guest
 
Posts: n/a
#4: Jul 22 '05

re: copying window text....please help! this language is insane.


"chris kramer" <zewkini8@yahoo.com> wrote...[color=blue]
> john - you are right..
> was overwhelmed and slightly drunk when i gave up and made a plea for
> help :)
> i have gotten closer - i can shut down a window in VB using WM_CLOSE
> message.
> (i gave up on using visual c++, it is absurdly complex)
> WM_COPY doesn't seem to work though. If anyone knows anyone that can
> get highlighted text from another window that won't allow direct
> copying, i'd love to know how. (zewkini8@yahoo.com)
> sorry about posting to the wrong place.. thank god Visual C++ is not
> something the world accepts as a standard. i think it is a complete
> nightmare.[/color]

Please don't apologise for off-topic, post in the right newsgroup
instead: comp.os.ms-windows.programmer.

Thank you.

V


Closed Thread