Problem : Copy/Paste in CListCtrl question
I have a CListCtrl object and I want to copy and paste from it (using Ctrl+c).
Can it be done ???
Solution : Copy/Paste in CListCtrl question
you can derive a class like the following and do it.
class CListCtrlWithCopy : public CListCtrl
afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
if((nChar == ‘C’ || nChar == ‘c’) && (GetKeyState(VK_CONTROL) & 0x8000))
int nPos = GetNextItem(-1, LVNI_SELECTED) ;
if(nPos != -1)
If you copy this code in your dialog header and cpp, and make a CListCtrlWithCopy object instead of CListCtrl object in your member variable, you can see the Ctrl+C sequence display the currently selected item in the listctrl if the listctrl has focus and an item is selected.
Search for “Copying Information to the Clipboard” in MSDN and you will get code to copy the text to clipboard.