void TABLE::tCopy() { RUNTIMEINFO* rtime = (RUNTIMEINFO*)AObjGetRuntimeInfo(theObject); ROW* row = rtime->GetRow(); long numRows = row->NumSelections(); long length = numRows; BOOL dbAccessed = FALSE; if(numRows<1 || numRows>row->NumRows()) return; for(long i=0; i<numRows; i++) length += row->RowLength(row->GetSelection(i), TRUE, &dbAccessed); HGLOBAL hClip = GlobalAlloc(GHND, length); if(!hClip) { if(dbAccessed) AEvtPostSignalAtMark(theObject, SIGNAL_TABLEAUTOFILLED); return; } char huge* clip = (char huge*)GlobalLock(hClip); long sel; long offset=0; for(i=0; i<numRows; i++) { sel = row->GetSelection(i); length = row->RowLength(sel, TRUE, &dbAccessed); row->GetRow(sel, clip+offset, length, TRUE, TRUE, &dbAccessed); if(i!=(numRows-1)) { // give the cr-lf combination *(clip+(offset + length - 1)) = '\r'; *(clip+(offset + length++)) = '\n'; } else *(clip+(offset + length - 1)) = 0; offset+=length; } GlobalUnlock(hClip); OpenClipboard(hParentWnd); EmptyClipboard(); SetClipboardData(CF_TEXT, hClip); CloseClipboard(); if(dbAccessed) AEvtPostSignalAtMark(theObject, SIGNAL_TABLEAUTOFILLED); }