AppendToLine Appends more information to the last line added. If logging is on and the addToLog param is TRUE then this line is also added to the log file. Params string - string to add addToLog - if TRUE then add to the file log, if it is enabled Return 0 - (UH_SUCCESS) 1 - (UH_ERROR) ***********************************/
| 1218 | 1 - (UH_ERROR) |
| 1219 | ***********************************/ |
| 1220 | int CUH_Control::AppendToLine(LPCTSTR string,BOOLEAN addToLog){ |
| 1221 | |
| 1222 | |
| 1223 | //enter into a critical section |
| 1224 | #ifdef UH_THREADSAFE |
| 1225 | EnterCriticalSection(&m_criticalSection); |
| 1226 | #endif |
| 1227 | |
| 1228 | int rt = UH_SUCCESS; |
| 1229 | |
| 1230 | if(m_historyList == NULL){ |
| 1231 | rt = UH_ERROR; |
| 1232 | } |
| 1233 | else if(m_historyList->m_string == NULL){ |
| 1234 | rt = UH_ERROR; |
| 1235 | } |
| 1236 | else{ |
| 1237 | //update the log file |
| 1238 | if(addToLog && m_enableLog) |
| 1239 | WriteToLog(string,FALSE); |
| 1240 | |
| 1241 | //check to see if a window exists |
| 1242 | if(m_hWnd != NULL){ |
| 1243 | |
| 1244 | int len = (int)_tcslen(string) + (int)_tcslen(m_historyList->m_string); |
| 1245 | _TCHAR *buf = new _TCHAR[len+1]; |
| 1246 | _tcscpy(buf,m_historyList->m_string); |
| 1247 | _tcscat(buf,string); |
| 1248 | |
| 1249 | delete[] m_historyList->m_string; |
| 1250 | m_historyList->m_string = buf; |
| 1251 | m_historyList->m_len = len; |
| 1252 | |
| 1253 | //store the max line width |
| 1254 | if(len > m_maxLineWidth){ |
| 1255 | m_maxLineWidth = len; |
| 1256 | UpdateScrollRange(); |
| 1257 | } |
| 1258 | //redraw the screen |
| 1259 | InvalidateRect(m_hWnd,NULL,TRUE); |
| 1260 | } |
| 1261 | } |
| 1262 | |
| 1263 | //exit the critical section |
| 1264 | #ifdef UH_THREADSAFE |
| 1265 | LeaveCriticalSection(&m_criticalSection); |
| 1266 | #endif |
| 1267 | |
| 1268 | return rt; |
| 1269 | } |
| 1270 | |
| 1271 | /********************************** |
| 1272 | ClearHistory |
nothing calls this directly
no outgoing calls
no test coverage detected