Reputation: 21
I'm currently working on code that I inherited. There is a class (I'll refer to it as logWindow) which inherits from CDialog. Overall the logWindow class creates a window and prints out text.
What I need to do is copy the text that is automatically generated in the window.
I know I need some sort of mouse and keyboard listener, but I'm a little lost on how to do this and how to select text.
I also have working code for a different log window written by the same person. That code has a class (I'll refer to it as copyList) which inherits from CListbox. Unfortunately the code isn't well documented or managed, so it is difficult to figure out which functions are related to copying text and which functions are related to other things such as auto scrolling.
I apologize if this is very unspecific, because of what I'm working on I'm limited in how much I can post. I will update the question with as much information as I can.
Upvotes: 1
Views: 1066
Reputation: 926
you can use GetWindowText or CWnd::GetWindowText to get the text from the control that holds the text, but this will copy all the text inside that control, so you will have to do tinker the text if you want some filtering.
you said you already have a CListBox example working so you know how to iterate over the items.
then you can use this link Clipboard: Using the Windows Clipboard and check how to handle the clipboard.
you could also add a simple button "Send to clipboard" that sends the text to the clipboard
Upvotes: 1