-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathHelper.cpp
651 lines (558 loc) · 18 KB
/
Helper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
/*
* Copyright (c) 2005-2018, BearWare.dk
*
* Contact Information:
*
* Bjoern D. Rasmussen
* Kirketoften 5
* DK-8260 Viby J
* Denmark
* Email: contact@bearware.dk
* Phone: +45 20 20 54 59
* Web: http://www.bearware.dk
*
* This source code is part of the TeamTalk SDK owned by
* BearWare.dk. Use of this file, or its compiled unit, requires a
* TeamTalk SDK License Key issued by BearWare.dk.
*
* The TeamTalk SDK License Agreement along with its Terms and
* Conditions are outlined in the file License.txt included with the
* TeamTalk SDK distribution.
*
*/
#include "stdafx.h"
#include <Mmsystem.h>
#include <queue>
#include <WinInet.h>
extern TTInstance* ttInst;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace std;
using namespace teamtalk;
BOOL ConvertFont( const MyFont font, LOGFONT& destination)
{
if( font.szFaceName.IsEmpty() || font.nSize <= 0)
return FALSE;
memset(&destination, 0, sizeof(LOGFONT));
_tcscpy(destination.lfFaceName, font.szFaceName);
destination.lfItalic = font.bItalic;
destination.lfUnderline = font.bUnderline;
if( font.bBold )
destination.lfWeight = destination.lfWeight | FW_BOLD;
HDC hdc = ::GetDC(NULL);
POINT pt;
pt.y = MulDiv(::GetDeviceCaps(hdc, LOGPIXELSY), font.nSize, 72);
::DPtoLP(hdc, &pt, 1);
destination.lfHeight = -pt.y;
::ReleaseDC(NULL, hdc);
return TRUE;
}
BOOL FileExists(LPCTSTR szFileName)
{
FILE* pFile = _tfopen(szFileName, _T("r"));
if(pFile == NULL)
return FALSE;
else
{
fclose(pFile);
return TRUE;
}
}
CString GetExecutableFolder()
{
// get folder of executing file
CString path;
GetModuleFileName(NULL, path.GetBufferSetLength(MAX_PATH), MAX_PATH);
return path.Left(path.ReverseFind('\\')+1);
}
BOOL DirectoryExists(LPCTSTR szPath)
{
DWORD dwAttrib = GetFileAttributes(szPath);
return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}
BOOL VersionSameOrLater(const CString& szCheck, const CString& szAgainst)
{
if(szCheck == szAgainst) return true;
int i = 0;
CStringList chk_tokens;
CString szToken = szCheck.Tokenize(_T("."), i);
while(!szToken.IsEmpty())
{
chk_tokens.AddTail(szToken);
szToken = szCheck.Tokenize(_T("."), i);
}
i = 0;
CStringList against_tokens;
szToken = szAgainst.Tokenize(_T("."), i);
while(!szToken.IsEmpty())
{
against_tokens.AddTail(szToken);
szToken = szAgainst.Tokenize(_T("."), i);
}
vector<int> vec_chk, vec_against;
for(POSITION pos = chk_tokens.GetHeadPosition();pos != NULL;)
vec_chk.push_back(_ttoi(chk_tokens.GetNext(pos)));
for(POSITION pos = against_tokens.GetHeadPosition();pos != NULL;)
vec_against.push_back(_ttoi(against_tokens.GetNext(pos)));
size_t less = vec_chk.size() < vec_against.size()?vec_chk.size():vec_against.size();
for(size_t i=0;i<less;i++)
if(vec_chk[i] < vec_against[i])
return false;
else if(vec_chk[i] > vec_against[i])
return true;
return true;
}
#if defined(UNICODE) || defined(_UNICODE)
CString STR_UTF8(LPCSTR str, int max_str_len/* = TT_STRLEN*/)
{
ASSERT(str);
wstring buff;
buff.resize(max_str_len);
if(buff.size())
{
int ret = MultiByteToWideChar(CP_UTF8, 0, str, -1, &buff[0], TT_STRLEN);
//int ret = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, buff, TT_STRLEN);
//if(ret == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
// mbstowcs(buff, str, TT_STRLEN);
}
return buff.c_str();
}
CString STR_UTF8(const std::string& str) { return STR_UTF8(str.c_str()); }
std::string STR_UTF8(LPCWSTR str, int max_str_len/* = TT_STRLEN*/)
{
ASSERT(str);
string buff;
buff.resize(max_str_len);
if(buff.size())
{
int ret = WideCharToMultiByte(CP_UTF8, 0, str, -1, &buff[0], int(buff.size()-1), NULL, NULL);
ASSERT(ret>0);
}
return buff.c_str();
}
std::string STR_LOCAL(LPCWSTR str, int max_str_len/* = TT_STRLEN*/)
{
ASSERT(str);
string buff;
buff.resize(max_str_len);
if(buff.size())
wcstombs(&buff[0], str, buff.size()-1);
return buff.c_str();
}
void COPYSTR(LPWSTR lpTarget, LPCSTR lpSource, int nLength)
{
ASSERT(lpTarget);
ASSERT(lpSource);
wcsncpy(lpTarget, STR_UTF8(lpSource).GetBuffer(), nLength);
}
void COPYSTR(LPSTR lpTarget, LPCWSTR lpSource, int nLength)
{
ASSERT(lpTarget);
ASSERT(lpSource);
strncpy(lpTarget, STR_UTF8(lpSource).c_str(), nLength);
}
#endif
static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg, LPARAM lParam, LPARAM lpData)
{
// If the BFFM_INITIALIZED message is received
// set the path to the start path.
switch (uMsg)
{
case BFFM_INITIALIZED:
{
if (NULL != lpData)
{
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
}
}
}
return 0; // The function should always return 0.
}
// HWND is the parent window.
// szCurrent is an optional start folder. Can be NULL.
// szPath receives the selected path on success. Must be MAX_PATH characters in length.
BOOL BrowseForFolder(HWND hwnd, LPCTSTR szCurrent, LPTSTR szPath)
{
BROWSEINFO bi = { 0 };
LPITEMIDLIST pidl;
TCHAR szDisplay[MAX_PATH];
BOOL retval;
//CoInitialize(NULL);
bi.hwndOwner = hwnd;
bi.pszDisplayName = szDisplay;
bi.lpszTitle = TEXT("Please choose a folder.");
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM) szCurrent;
pidl = SHBrowseForFolder(&bi);
if (NULL != pidl)
{
retval = SHGetPathFromIDList(pidl, szPath);
CoTaskMemFree(pidl);
}
else
{
retval = FALSE;
}
if (!retval)
{
szPath[0] = TEXT('\0');
}
//CoUninitialize();
return retval;
}
void SetWindowNumber(CWnd& wnd, int nNumber)
{
CString s;
s.Format(_T("%d"), nNumber);
wnd.SetWindowText(s);
}
int GetWindowNumber(CWnd& wnd)
{
CString s;
wnd.GetWindowText(s);
return _ttoi(s);
}
void AddString(CComboBox& wnd, LPCTSTR szText, DWORD_PTR nItemData)
{
int nIndex = wnd.AddString(szText);
wnd.SetItemData(nIndex, nItemData);
}
DWORD_PTR GetItemData(CComboBox& wnd, DWORD_PTR dwDefault)
{
int nCur = wnd.GetCurSel();
if(nCur != CB_ERR)
return wnd.GetItemData(nCur);
return dwDefault;
}
void SetCurSelItemData(CComboBox& wnd, DWORD_PTR nItemData)
{
int nItems = wnd.GetCount();
for(int i=0;i<nItems;i++)
{
if(wnd.GetItemData(i) == nItemData)
{
wnd.SetCurSel(i);
return;
}
}
}
DWORD_PTR GetItemData(CListBox& wnd, DWORD_PTR dwDefault)
{
int nCur = wnd.GetCurSel();
if(nCur != LB_ERR)
return wnd.GetItemData(nCur);
return dwDefault;
}
HTREEITEM GetItemDataItem(CTreeCtrl& wnd, DWORD_PTR dwItemData)
{
HTREEITEM hItem = wnd.GetRootItem();
HTREEITEM hResult = 0;
std::queue<HTREEITEM> items;
items.push(hItem);
while(items.size() && hResult == 0)
{
hItem = items.front();
items.pop();
if(dwItemData == wnd.GetItemData(hItem))
{
hResult = hItem;
break;
}
else if(wnd.ItemHasChildren(hItem))
items.push(wnd.GetChildItem(hItem));
else if(wnd.GetNextSiblingItem(hItem))
items.push(wnd.GetNextSiblingItem(hItem));
}
return hResult;
}
void PlayWaveFile(LPCTSTR szFilePath, BOOL bAsync)
{
::PlaySound(szFilePath, NULL, SND_FILENAME | (bAsync ? SND_ASYNC : SND_SYNC));
TRACE(_T("PLAY %s\n"), szFilePath);
}
int nTextLimit = TT_STRLEN;
BOOL bShowUsernames = FALSE;
CString LimitText(const CString& szName)
{
if(szName.GetLength() <= nTextLimit)
return szName;
return szName.Left(nTextLimit) + _T("...");
}
CString StripAmpersand(const CString& szText)
{
CString szResult = szText;
szResult.Replace(_T("&"), _T(""));
return szResult;
}
CString ExtractMenuText(int nID, CString szText)
{
TRANSLATE_ITEM(nID, szText);
szText.Replace(_T("&"), _T(""));
int i = szText.ReverseFind('\t');
if(i >= 0)
szText = szText.Left(i);
return szText;
}
CString LoadText(int nID, CString szInitial)
{
szInitial.LoadString(nID);
TRANSLATE_ITEM(nID, szInitial);
return szInitial;
}
void RemoveString(CStringList& strList, const CString& szStr)
{
POSITION pos;
while((pos = strList.Find(szStr)) != NULL)
strList.RemoveAt(pos);
}
CString GetLogTimeStamp()
{
CTime tm = CTime::GetCurrentTime();
CString szTime;
szTime.Format(_T("%.4d%.2d%.2d-%.2d%.2d%.2d"), tm.GetYear(), tm.GetMonth(),
tm.GetDay(), tm.GetHour(), tm.GetMinute(), tm.GetSecond());
return szTime;
}
CString GetLogFileName(LPCTSTR szFolder, LPCTSTR szName)
{
CString szPath = szFolder;
szPath.Format(_T("%s\\%s - %s"), szFolder, GetLogTimeStamp(),
TrimForPath(szName).GetBuffer());
return szPath;
}
CString TrimForPath(LPCTSTR szPath)
{
CString szTmp = szPath;
szTmp.Trim(_T("\\/:?\"<>|"));
return szTmp;
}
BOOL OpenLogFile(CFile& file, LPCTSTR szFolder, LPCTSTR szName, CString& szLogFileName)
{
CloseLogFile(file);
CString szFileName = GetLogFileName(szFolder, szName);
szLogFileName = szFileName;
return file.Open(szFileName,
CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate);
}
void CloseLogFile(CFile& file)
{
if(file.m_hFile != CFile::hFileNull)
{
CString szFileName = file.GetFilePath();
ULONGLONG uSize = file.GetLength();
file.Close();
if(uSize == 0)
CFile::Remove(szFileName);
}
}
void WriteLogMsg(CFile& file, LPCTSTR szMsg)
{
if(file.m_hFile == CFile::hFileNull)
return;
std::string utf8 = STR_UTF8(szMsg);
file.Write(utf8.c_str(), (UINT)utf8.size());
}
void UpdateAllowTransmitMenuItem(int nUserID, const Channel& chan,
StreamTypes uStreamType, CCmdUI *pCmdUI)
{
BOOL b = FALSE;
transmitusers_t users;
b = (GetTransmitUsers(chan, users)[nUserID] & uStreamType);
if (chan.uChannelType & CHANNEL_CLASSROOM)
{
pCmdUI->Enable(CanToggleTransmitUsers(chan.nChannelID));
pCmdUI->SetCheck(b);
}
else
{
pCmdUI->Enable(CanToggleTransmitUsers(chan.nChannelID) && nUserID != TT_CLASSROOM_FREEFORALL);
pCmdUI->SetCheck(!b && nUserID != TT_CLASSROOM_FREEFORALL);
}
}
CString GetDisplayName(const User& user)
{
if(bShowUsernames)
return LimitText(user.szUsername);
CString szNickname = LimitText(user.szNickname);
if (szNickname.IsEmpty())
{
szNickname.Format(_T("%s - #%d"), LoadText(IDS_DEFAULTNICKNAME, DEFAULT_NICKNAME), user.nUserID);
}
return LimitText(szNickname);
}
BOOL EndsWith(const CString& szText, LPCTSTR szEnd, BOOL bCaseSensitive)
{
return bCaseSensitive? szText.Right(int(_tcslen(szEnd))) == szEnd : szText.Right(int(_tcslen(szEnd))).CompareNoCase(szEnd) == 0;
}
BOOL StartsWith(const CString& szText, LPCTSTR szStart, BOOL bCaseSensitive)
{
return bCaseSensitive ? szText.Left(int(_tcslen(szStart))) == szStart : szText.Left(int(_tcslen(szStart))).CompareNoCase(szStart) == 0;
}
BOOL IsWebLogin(const CString& szUsername)
{
return szUsername == WEBLOGIN_BEARWARE_USERNAME || EndsWith(szUsername, _T(WEBLOGIN_BEARWARE_USERNAMEPOSTFIX));
}
CString URLEncode(const CString& szText)
{
TCHAR szEncodedText[INTERNET_MAX_URL_LENGTH] = _T("");
DWORD dwNewLen = INTERNET_MAX_URL_LENGTH;
UrlEscape(szText, szEncodedText, &dwNewLen, URL_ESCAPE_PERCENT | URL_ESCAPE_AS_UTF8);
return szEncodedText;
}
CString URLDecode(const CString& szUrlText)
{
TCHAR szDecodedText[INTERNET_MAX_URL_LENGTH] = _T("");
_tcsncpy(szDecodedText, szUrlText, INTERNET_MAX_URL_LENGTH);
DWORD dwNewLen = INTERNET_MAX_URL_LENGTH;
HRESULT hr = UrlUnescape(szDecodedText, szDecodedText, &dwNewLen, URL_UNESCAPE_INPLACE);
return szDecodedText;
}
// The horror... initguid.h must be included before oleacc.h but oleacc.h is included
// by afxwin.h which has to be the first include file in a MFC project...
#undef INITGUID
#include <InitGuid.h>
DEFINE_GUID(CLSID_AccPropServices, 0xb5f8350b, 0x0548, 0x48b1, 0xa6, 0xee, 0x88, 0xbd, 0x00, 0xb4, 0xa5, 0xe7);
DEFINE_GUID( PROPID_ACC_NAME , 0x608d3df8, 0x8128, 0x4aa7, 0xa4, 0x28, 0xf5, 0x5e, 0x49, 0x26, 0x72, 0x91);
void SetAccessibleName(CWnd& wnd, LPCTSTR szHint)
{
// COM is assumed to be initialized...
IAccPropServices* pAccPropServices = NULL;
HRESULT hr = CoCreateInstance(CLSID_AccPropServices,
NULL, CLSCTX_SERVER, IID_IAccPropServices,
(void**)&pAccPropServices);
if (SUCCEEDED(hr))
{
hr = pAccPropServices->SetHwndPropStr(wnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_NAME, szHint);
pAccPropServices->Release();
}
}
int GetSoundInputDevice(teamtalk::ClientXML& xmlSettings, SoundDevice* pSoundDev/* = NULL*/)
{
int nInputDevice = xmlSettings.GetSoundInputDevice(-1);
if(nInputDevice == -1)
TT_GetDefaultSoundDevices(&nInputDevice, NULL);
CString szInputDevice = STR_UTF8(xmlSettings.GetSoundInputDevice());
SoundDevice dev;
if(!pSoundDev)
pSoundDev = &dev;
if(GetSoundDevice(nInputDevice, szInputDevice, TRUE, *pSoundDev))
return pSoundDev->nDeviceID;
return nInputDevice;
}
int GetSoundOutputDevice(teamtalk::ClientXML& xmlSettings, SoundDevice* pSoundDev/* = NULL*/)
{
int nOutputDevice = xmlSettings.GetSoundOutputDevice(-1);
if(nOutputDevice == -1)
TT_GetDefaultSoundDevices(NULL, &nOutputDevice);
CString szOutputDevice = STR_UTF8(xmlSettings.GetSoundOutputDevice());
SoundDevice dev;
if(!pSoundDev)
pSoundDev = &dev;
if(GetSoundDevice(nOutputDevice, szOutputDevice, FALSE, *pSoundDev))
return pSoundDev->nDeviceID;
return nOutputDevice;
}
BOOL GetSoundDevice(int nSoundDeviceID, const CString& szDeviceID, BOOL bInput, SoundDevice& dev)
{
int count = 25;
std::vector<SoundDevice> devices(count);
TT_GetSoundDevices(&devices[0], &count);
if (count == 25)
{
TT_GetSoundDevices(NULL, &count);
devices.resize(count);
TT_GetSoundDevices(&devices[0], &count);
}
devices.resize(count);
size_t i;
for (i = 0; i < devices.size() && szDeviceID.GetLength(); i++)
{
if (devices[i].szDeviceID == szDeviceID &&
((bInput && devices[i].nMaxInputChannels > 0) || (!bInput && devices[i].nMaxOutputChannels > 0)))
{
dev = devices[i];
return true;
}
}
for (i = 0; i < devices.size(); i++)
{
if (devices[i].nDeviceID == nSoundDeviceID)
{
dev = devices[i];
return true;
}
}
return false;
}
int GetSoundDuplexSampleRate(const SoundDevice& indev, const SoundDevice& outdev)
{
if ((indev.uSoundDeviceFeatures & SOUNDDEVICEFEATURE_DUPLEXMODE) == SOUNDDEVICEFEATURE_NONE)
return 0;
auto isend = indev.inputSampleRates + sizeof(indev.inputSampleRates);
auto isr = std::find_if(indev.inputSampleRates, isend,
[outdev](int sr)
{
return sr == outdev.nDefaultSampleRate &&
(outdev.uSoundDeviceFeatures & SOUNDDEVICEFEATURE_DUPLEXMODE) == SOUNDDEVICEFEATURE_DUPLEXMODE;
});
return isr != isend ? outdev.nDefaultSampleRate : 0;
}
BOOL IsSoundDeviceEchoCapable(const SoundDevice& indev, const SoundDevice& outdev)
{
return GetSoundDuplexSampleRate(indev, outdev) > 0 || (indev.uSoundDeviceFeatures & SOUNDDEVICEFEATURE_AEC);
}
BOOL InitSoundSystem(teamtalk::ClientXML& xmlSettings, SoundDevice& indev, SoundDevice& outdev)
{
TT_CloseSoundInputDevice(ttInst);
TT_CloseSoundOutputDevice(ttInst);
TT_CloseSoundDuplexDevices(ttInst);
//Restart sound system so we have the latest sound devices
TT_RestartSoundSystem();
int nInputDevice = GetSoundInputDevice(xmlSettings, &indev);
int nOutputDevice = GetSoundOutputDevice(xmlSettings, &outdev);
BOOL bEchoCancel = xmlSettings.GetEchoCancel(DEFAULT_ECHO_ENABLE);
BOOL bDuplex = GetSoundDuplexSampleRate(indev, outdev) > 0;
SoundDeviceEffects effects = {};
if (!bDuplex && bEchoCancel && (indev.uSoundDeviceFeatures & SOUNDDEVICEFEATURE_AEC))
effects.bEnableEchoCancellation = bEchoCancel;
TT_SetSoundDeviceEffects(ttInst, &effects);
BOOL bSuccess = FALSE;
if (bDuplex || (effects.bEnableEchoCancellation && (indev.nSoundSystem == SOUNDSYSTEM_WASAPI)))
{
bSuccess = TT_InitSoundDuplexDevices(ttInst, nInputDevice, nOutputDevice);
}
else
{
bSuccess = TT_InitSoundInputDevice(ttInst, nInputDevice) &&
TT_InitSoundOutputDevice(ttInst, nOutputDevice);
}
if (!bSuccess)
{
TT_CloseSoundInputDevice(ttInst);
TT_CloseSoundOutputDevice(ttInst);
TT_CloseSoundDuplexDevices(ttInst);
indev = {};
outdev = {};
if (TT_GetDefaultSoundDevices(&nInputDevice, &nOutputDevice))
{
if (TT_InitSoundInputDevice(ttInst, nInputDevice))
GetSoundDevice(nInputDevice, _T(""), TRUE, indev);
if (TT_InitSoundOutputDevice(ttInst, nOutputDevice))
GetSoundDevice(nOutputDevice, _T(""), FALSE, outdev);
}
}
return bSuccess;
}
extern BOOL g_bSpeech;
void AddTextToSpeechMessage(const CString& szMsg)
{
#if defined(ENABLE_TOLK)
if(g_bSpeech)
Tolk_Output(szMsg);
#endif
}