Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

452 lines
9.1 KiB

  1. #include "stdafx.h"
  2. #include "t3test.h"
  3. #include "t3testD.h"
  4. #include "calldlg.h"
  5. #include "callnot.h"
  6. #include "externs.h"
  7. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  8. //
  9. // GetMediaTypeName
  10. //
  11. // Convert the mediatype bstr to a string, like
  12. // "audio in"
  13. //
  14. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  15. void CT3testDlg::GetMediaTypeName(
  16. long lMediaType,
  17. LPWSTR szString
  18. )
  19. {
  20. if (lMediaType == (long)LINEMEDIAMODE_AUTOMATEDVOICE)
  21. {
  22. lstrcpyW(
  23. szString,
  24. L"Audio"
  25. );
  26. }
  27. else if (lMediaType == (long)LINEMEDIAMODE_VIDEO)
  28. {
  29. lstrcpyW(
  30. szString,
  31. L"Video"
  32. );
  33. }
  34. else if (lMediaType == (long)LINEMEDIAMODE_DATAMODEM)
  35. {
  36. lstrcpyW(
  37. szString,
  38. L"DataModem"
  39. );
  40. }
  41. else if (lMediaType == (long)LINEMEDIAMODE_G3FAX)
  42. {
  43. lstrcpyW(
  44. szString,
  45. L"G3Fax"
  46. );
  47. }
  48. else
  49. {
  50. lstrcpyW(
  51. szString,
  52. L"Unknown MediaType - "
  53. );
  54. }
  55. }
  56. LPWSTR CT3testDlg::GetCallPrivilegeName(
  57. ITCallInfo * pCall
  58. )
  59. {
  60. CALL_PRIVILEGE cp;
  61. pCall->get_Privilege( &cp );
  62. if (CP_OWNER == cp)
  63. {
  64. return SysAllocString(L"OWNER");
  65. }
  66. else
  67. {
  68. return SysAllocString(L"MONITOR");
  69. }
  70. return NULL;
  71. }
  72. LPWSTR CT3testDlg::GetCallStateName(
  73. ITCallInfo * pCall
  74. )
  75. {
  76. CALL_STATE cs;
  77. //
  78. // get the current call state
  79. //
  80. pCall->get_CallState( &cs );
  81. //
  82. // make the name
  83. //
  84. switch( cs )
  85. {
  86. case CS_INPROGRESS:
  87. return SysAllocString( L"INPROGRESS" );
  88. break;
  89. case CS_CONNECTED:
  90. return SysAllocString ( L"CONNECTED" );
  91. break;
  92. case CS_DISCONNECTED:
  93. return SysAllocString ( L"DISCONNECTED" );
  94. break;
  95. case CS_OFFERING:
  96. return SysAllocString ( L"OFFERING" );
  97. break;
  98. case CS_IDLE:
  99. return SysAllocString( L"IDLE" );
  100. break;
  101. default:
  102. return SysAllocString( L"<Unknown Call State>" );
  103. break;
  104. }
  105. return NULL;
  106. }
  107. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  108. //
  109. // GetAddress
  110. //
  111. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  112. BOOL CT3testDlg::GetAddress( ITAddress ** ppAddress )
  113. {
  114. HTREEITEM hItem;
  115. TV_ITEM item;
  116. hItem = TreeView_GetSelection(
  117. ghAddressesWnd
  118. );
  119. if (NULL == hItem)
  120. {
  121. return FALSE;
  122. }
  123. item.mask = TVIF_HANDLE | TVIF_PARAM;
  124. item.hItem = hItem;
  125. TreeView_GetItem(
  126. ghAddressesWnd,
  127. &item
  128. );
  129. *ppAddress = (ITAddress *)item.lParam;
  130. if (NULL == *ppAddress)
  131. {
  132. // ::MessageBox(NULL, L"Select an Address", NULL, MB_OK);
  133. return FALSE;
  134. }
  135. return TRUE;
  136. }
  137. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  138. //
  139. // GetTerminal
  140. //
  141. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  142. BOOL CT3testDlg::GetTerminal( ITTerminal ** ppTerminal )
  143. {
  144. HTREEITEM hItem;
  145. TV_ITEM item;
  146. hItem = TreeView_GetSelection(
  147. ghTerminalsWnd
  148. );
  149. if (NULL == hItem)
  150. {
  151. return FALSE;
  152. }
  153. item.mask = TVIF_HANDLE | TVIF_PARAM;
  154. item.hItem = hItem;
  155. TreeView_GetItem(
  156. ghTerminalsWnd,
  157. &item
  158. );
  159. *ppTerminal = (ITTerminal *)item.lParam;
  160. if (NULL == *ppTerminal)
  161. {
  162. ::MessageBox(NULL, L"Select a Terminal", NULL, MB_OK);
  163. return FALSE;
  164. }
  165. return TRUE;
  166. }
  167. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  168. //
  169. // GetCall
  170. //
  171. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  172. BOOL CT3testDlg::GetCall( ITCallInfo ** ppCallInfo )
  173. {
  174. HTREEITEM hItem;
  175. TV_ITEM item;
  176. hItem = TreeView_GetSelection(
  177. ghCallsWnd
  178. );
  179. if (NULL == hItem)
  180. {
  181. return FALSE;
  182. }
  183. item.mask = TVIF_HANDLE | TVIF_PARAM;
  184. item.hItem = hItem;
  185. TreeView_GetItem(
  186. ghCallsWnd,
  187. &item
  188. );
  189. *ppCallInfo = (ITCallInfo *)item.lParam;
  190. if (NULL == *ppCallInfo)
  191. {
  192. //::MessageBox(NULL, L"Select a Call", NULL, MB_OK);
  193. return FALSE;
  194. }
  195. return TRUE;
  196. }
  197. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  198. //
  199. // GetMediaType
  200. //
  201. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  202. BOOL CT3testDlg::GetMediaType( long * plMediaType )
  203. {
  204. HTREEITEM hItem;
  205. TV_ITEM item;
  206. hItem = TreeView_GetSelection(
  207. ghMediaTypesWnd
  208. );
  209. if (NULL == hItem)
  210. {
  211. return FALSE;
  212. }
  213. item.mask = TVIF_HANDLE | TVIF_PARAM;
  214. item.hItem = hItem;
  215. TreeView_GetItem(
  216. ghMediaTypesWnd,
  217. &item
  218. );
  219. *plMediaType = (long)(item.lParam);
  220. if (0 == *plMediaType)
  221. {
  222. return FALSE;
  223. }
  224. return TRUE;
  225. }
  226. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  227. //
  228. // GetTerminalClass
  229. //
  230. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  231. BOOL CT3testDlg::GetTerminalClass( BSTR * pbstrClass )
  232. {
  233. HTREEITEM hItem;
  234. TV_ITEM item;
  235. GUID * pguid;
  236. hItem = TreeView_GetSelection(
  237. ghClassesWnd
  238. );
  239. if (NULL == hItem)
  240. {
  241. return FALSE;
  242. }
  243. item.mask = TVIF_HANDLE | TVIF_PARAM;
  244. item.hItem = hItem;
  245. TreeView_GetItem(
  246. ghClassesWnd,
  247. &item
  248. );
  249. pguid = (GUID *)item.lParam;
  250. if (NULL == pguid)
  251. {
  252. return FALSE;
  253. }
  254. LPWSTR lphold;
  255. StringFromIID(
  256. *pguid,
  257. &lphold
  258. );
  259. *pbstrClass = SysAllocString(lphold);
  260. CoTaskMemFree(lphold);
  261. return TRUE;
  262. }
  263. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  264. //
  265. // GetCreatedTerminal
  266. //
  267. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  268. BOOL CT3testDlg::GetCreatedTerminal( ITTerminal ** ppTerminal )
  269. {
  270. HTREEITEM hItem;
  271. TV_ITEM item;
  272. hItem = TreeView_GetSelection(
  273. ghCreatedWnd
  274. );
  275. if (NULL == hItem)
  276. {
  277. return FALSE;
  278. }
  279. item.mask = TVIF_HANDLE | TVIF_PARAM;
  280. item.hItem = hItem;
  281. TreeView_GetItem(
  282. ghCreatedWnd,
  283. &item
  284. );
  285. *ppTerminal = (ITTerminal *)item.lParam;
  286. if (NULL == *ppTerminal)
  287. {
  288. return FALSE;
  289. }
  290. return TRUE;
  291. }
  292. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  293. //
  294. // GetSelectedTerminal
  295. //
  296. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  297. BOOL CT3testDlg::GetSelectedTerminal( ITTerminal ** ppTerminal )
  298. {
  299. HTREEITEM hItem;
  300. TV_ITEM item;
  301. hItem = TreeView_GetSelection(
  302. ghSelectedWnd
  303. );
  304. if (NULL == hItem)
  305. {
  306. return FALSE;
  307. }
  308. item.mask = TVIF_HANDLE | TVIF_PARAM;
  309. item.hItem = hItem;
  310. TreeView_GetItem(
  311. ghSelectedWnd,
  312. &item
  313. );
  314. *ppTerminal = (ITTerminal *)item.lParam;
  315. if (NULL == *ppTerminal)
  316. {
  317. return FALSE;
  318. }
  319. return TRUE;
  320. }
  321. BSTR CT3testDlg::GetTerminalClassName( GUID * pguid )
  322. {
  323. if (IsEqualIID( *pguid, CLSID_VideoWindowTerm ))
  324. {
  325. return SysAllocString( L"Video" );
  326. }
  327. #ifdef ENABLE_DIGIT_DETECTION_STUFF
  328. else if (IsEqualIID( *pguid, CLSID_DigitTerminal ))
  329. {
  330. return SysAllocString( L"Digit Terminal" );
  331. }
  332. else if (IsEqualIID( *pguid, CLSID_DataTerminal ))
  333. {
  334. return SysAllocString( L"Data Terminal" );
  335. }
  336. #endif // ENABLE_DIGIT_DETECTION_STUFF
  337. else
  338. {
  339. return SysAllocString( L"Unknown Dynamic Type" );
  340. }
  341. return NULL;
  342. }