Pasting to a list control
1/3/2004 15:50 PM LastName, FirstName (773) 588-2300
There are 4 columns hence 4 items of data: the date, the time, full name, and phone number.
When I paste, I want these items of data to fall into a new row (the first row at the very top). I am having a hard time achieving this.
This is my code thus far...
void CNatashaDlg::OnEditPaste()
{
// Test to see if we can open the clipboard first.
if (OpenClipboard())
{
// Retrieve the Clipboard data (specifying that
// we want ANSI text (via the CF_TEXT value).
HANDLE hClipboardData = GetClipboardData(CF_TEXT);
// Call GlobalLock so that to retrieve a pointer
// to the data associated with the handle returned
// from GetClipboardData.
char *pchData = (char*)GlobalLock(hClipboardData);
// Set a local CString variable to the data
CString strFromClipboard = pchData;
// Unlock the global memory.
GlobalUnlock(hClipboardData);
// Finally, when finished I simply close the Clipboard
// which has the effect of unlocking it so that other
// applications can examine or modify its contents.
m_logList.InsertItem(0, "");
m_logList.SetItemText(0, 0, "");
m_logList.SetItemText(0, 1, "");
m_logList.SetItemText(0, 2, "");
m_logList.SetItemText(0, 3, "");
CloseClipboard();
}
}
I'm not sure how to take whatever is in the clipboard and seperate it so that each columns gets the appropriate fields. Can someone help me with this? Thank you.

