MSHTML::IHTMLTableRowPtr CDHtmlObjectModel::addTableRow( char *table, char *type, char *inTime, char *outTime, char *project, char *comment) { // Retrieve all of the page elements. MSHTML::IHTMLTablePtr spTable; MSHTML::IHTMLElementCollectionPtr spAllElements = m_spDocument2->Getall(); _variant_t vaTag( table); if((spTable = spAllElements->item( vaTag)) != NULL) { // We have found the table, so now add a row. MSHTML::IHTMLTableRowPtr spRow( spTable->insertRow( 1)); MSHTML::IHTMLTableCellPtr spType( spRow->insertCell( 0)); MSHTML::IHTMLTableCellPtr spTimeIn( spRow->insertCell( 1)); MSHTML::IHTMLTableCellPtr spTimeOut( spRow->insertCell( 2)); MSHTML::IHTMLTableCellPtr spProject( spRow->insertCell( 3)); MSHTML::IHTMLTableCellPtr spComment( spRow->insertCell( 4)); // Here is the compiler trick again. // If a series of variables are created // that are identical in size, the memory will be // reused and it will not cost an extra allocation. // Neat trick, eh! { MSHTML::IHTMLElementPtr spAnElement = spType; _bstr_t bstrStr( type); spAnElement->PutinnerText( bstrStr); } |