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.

457 lines
9.4 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. // AddListen
  10. //
  11. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  12. void CT3testDlg::AddListen( long lMediaType )
  13. {
  14. WCHAR szName[256];
  15. TV_INSERTSTRUCT tvi;
  16. //
  17. // map the mediatype bstr to
  18. // a string name (like "audio in")
  19. //
  20. GetMediaTypeName(
  21. lMediaType,
  22. szName
  23. );
  24. //
  25. // insert that string into the
  26. // listen window
  27. //
  28. tvi.hParent = ghListenRoot;
  29. tvi.hInsertAfter = TVI_LAST;
  30. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  31. tvi.item.pszText = szName;
  32. tvi.item.lParam = (LPARAM) lMediaType;
  33. TreeView_InsertItem(
  34. ghListenWnd,
  35. &tvi
  36. );
  37. //
  38. // select the first item
  39. //
  40. SelectFirstItem(
  41. ghListenWnd,
  42. ghListenRoot
  43. );
  44. }
  45. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  46. //
  47. // AddAddressToTree
  48. //
  49. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  50. void CT3testDlg::AddAddressToTree( ITAddress * pAddress )
  51. {
  52. BSTR bstrName;
  53. TV_INSERTSTRUCT tvi;
  54. //
  55. // get the name of the address
  56. //
  57. pAddress->get_AddressName( &bstrName );
  58. //
  59. // set up struct
  60. //
  61. tvi.hParent = ghAddressesRoot;
  62. tvi.hInsertAfter = TVI_LAST;
  63. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  64. tvi.item.pszText = bstrName;
  65. tvi.item.lParam = (LPARAM) pAddress;
  66. //
  67. // addref
  68. //
  69. pAddress->AddRef();
  70. //
  71. // insert it
  72. //
  73. TreeView_InsertItem(
  74. ghAddressesWnd,
  75. &tvi
  76. );
  77. //
  78. // free name
  79. //
  80. SysFreeString( bstrName );
  81. }
  82. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  83. //
  84. // AddMediaType
  85. //
  86. // Add a mediatype to the mediatype tree
  87. //
  88. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  89. void CT3testDlg::AddMediaType( long lMediaType )
  90. {
  91. WCHAR szString[256];
  92. TV_INSERTSTRUCT tvi;
  93. //
  94. // get the displayable name
  95. //
  96. GetMediaTypeName(
  97. lMediaType,
  98. szString
  99. );
  100. //
  101. // set up struct
  102. //
  103. tvi.hParent = ghMediaTypesRoot;
  104. tvi.hInsertAfter = TVI_LAST;
  105. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  106. tvi.item.pszText = szString;
  107. tvi.item.lParam = (LPARAM) lMediaType;
  108. //
  109. // add the item
  110. //
  111. TreeView_InsertItem(
  112. ghMediaTypesWnd,
  113. &tvi
  114. );
  115. //
  116. // select the first item
  117. //
  118. SelectFirstItem(
  119. ghMediaTypesWnd,
  120. ghMediaTypesRoot
  121. );
  122. }
  123. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  124. //
  125. // AddCall
  126. //
  127. // Add a call to the call tree
  128. //
  129. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  130. void CT3testDlg::AddCall( ITCallInfo * pCall )
  131. {
  132. TV_INSERTSTRUCT tvi;
  133. HTREEITEM hItem;
  134. CALL_PRIVILEGE cp;
  135. CALL_STATE cs;
  136. WCHAR pszName[16];
  137. //
  138. // for the name of the call, use
  139. // the pointer!
  140. //
  141. wsprintf(
  142. pszName,
  143. L"0x%lx",
  144. pCall
  145. );
  146. //
  147. // set up struct
  148. //
  149. tvi.hParent = ghCallsRoot;
  150. tvi.hInsertAfter = TVI_LAST;
  151. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  152. tvi.item.pszText = pszName;
  153. tvi.item.lParam = (LPARAM) pCall;
  154. //
  155. // save a reference
  156. //
  157. pCall->AddRef();
  158. //
  159. // insert the item
  160. //
  161. hItem = TreeView_InsertItem(
  162. ghCallsWnd,
  163. &tvi
  164. );
  165. if (NULL != hItem)
  166. {
  167. //
  168. // select the item
  169. //
  170. TreeView_SelectItem(
  171. ghCallsWnd,
  172. hItem
  173. );
  174. }
  175. }
  176. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  177. //
  178. // AddTerminal
  179. //
  180. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  181. void CT3testDlg::AddTerminal( ITTerminal * pTerminal )
  182. {
  183. BSTR bstrName;
  184. BSTR bstrClass;
  185. TV_INSERTSTRUCT tvi;
  186. TERMINAL_DIRECTION td;
  187. WCHAR szName[256];
  188. //
  189. // get the name of the terminal
  190. //
  191. pTerminal->get_Name( &bstrName );
  192. pTerminal->get_Direction( &td );
  193. if (td == TD_RENDER)
  194. {
  195. wsprintfW(szName, L"%s [Playback]", bstrName);
  196. }
  197. else if (td == TD_CAPTURE)
  198. {
  199. wsprintfW(szName, L"%s [Record]", bstrName);
  200. }
  201. else //if (TD == TD_BOTH)
  202. {
  203. lstrcpyW(szName, bstrName);
  204. }
  205. //
  206. // set up the structure
  207. //
  208. tvi.hParent = ghTerminalsRoot;
  209. tvi.hInsertAfter = TVI_LAST;
  210. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  211. tvi.item.pszText = szName;
  212. tvi.item.lParam = (LPARAM) pTerminal;
  213. //
  214. // keep a refence to the terminal
  215. //
  216. pTerminal->AddRef();
  217. //
  218. // add it
  219. //
  220. TreeView_InsertItem(
  221. ghTerminalsWnd,
  222. &tvi
  223. );
  224. //
  225. // free the name
  226. //
  227. SysFreeString( bstrName );
  228. //
  229. // select
  230. //
  231. SelectFirstItem(
  232. ghTerminalsWnd,
  233. ghTerminalsRoot
  234. );
  235. }
  236. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  237. //
  238. // AddTerminalClass
  239. //
  240. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  241. void CT3testDlg::AddTerminalClass( GUID * pguid )
  242. {
  243. TV_INSERTSTRUCT tvi;
  244. //
  245. // get the name
  246. //
  247. tvi.item.pszText = GetTerminalClassName( pguid );
  248. //
  249. // set up the struct
  250. //
  251. tvi.hParent = ghClassesRoot;
  252. tvi.hInsertAfter = TVI_LAST;
  253. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  254. tvi.item.lParam = (LPARAM) pguid;
  255. //
  256. // insert the item
  257. //
  258. TreeView_InsertItem(
  259. ghClassesWnd,
  260. &tvi
  261. );
  262. SysFreeString( tvi.item.pszText );
  263. //
  264. // select item
  265. //
  266. SelectFirstItem(
  267. ghClassesWnd,
  268. ghClassesRoot
  269. );
  270. }
  271. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  272. //
  273. // AddCreatedTerminal
  274. //
  275. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  276. void CT3testDlg::AddCreatedTerminal( ITTerminal * pTerminal )
  277. {
  278. BSTR bstrName;
  279. TV_INSERTSTRUCT tvi;
  280. //
  281. // get the name
  282. //
  283. pTerminal->get_Name( &bstrName );
  284. //
  285. // set up the structure
  286. //
  287. tvi.hParent = ghCreatedRoot;
  288. tvi.hInsertAfter = TVI_LAST;
  289. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  290. if ( ( NULL == bstrName ) || (NULL == bstrName[0] ))
  291. {
  292. tvi.item.pszText = L"<No Name Given>";
  293. }
  294. else
  295. {
  296. tvi.item.pszText = bstrName;
  297. }
  298. tvi.item.lParam = (LPARAM) pTerminal;
  299. //
  300. // keep reference
  301. //
  302. pTerminal->AddRef();
  303. //
  304. // insert
  305. //
  306. TreeView_InsertItem(
  307. ghCreatedWnd,
  308. &tvi
  309. );
  310. SysFreeString( bstrName );
  311. //
  312. // select
  313. //
  314. SelectFirstItem(
  315. ghCreatedWnd,
  316. ghCreatedRoot
  317. );
  318. }
  319. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  320. //
  321. // AddSelectedTerminal
  322. //
  323. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  324. void CT3testDlg::AddSelectedTerminal(
  325. ITTerminal * pTerminal
  326. )
  327. {
  328. BSTR bstrName;
  329. BSTR pMediaType;
  330. TV_INSERTSTRUCT tvi;
  331. TERMINAL_DIRECTION td;
  332. WCHAR szName[256];
  333. //
  334. // get the name
  335. //
  336. pTerminal->get_Name( &bstrName );
  337. pTerminal->get_Direction( &td );
  338. if (td == TD_RENDER)
  339. {
  340. wsprintfW(szName, L"%s [Playback]", bstrName);
  341. }
  342. else if (td == TD_CAPTURE)
  343. {
  344. wsprintfW(szName, L"%s [Record]", bstrName);
  345. }
  346. else //if (TD == TD_BOTH)
  347. {
  348. lstrcpyW(szName, bstrName);
  349. }
  350. //
  351. // set up the struct
  352. //
  353. tvi.hParent = ghSelectedRoot;
  354. tvi.hInsertAfter = TVI_LAST;
  355. tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
  356. tvi.item.pszText = szName;
  357. tvi.item.lParam = (LPARAM) pTerminal;
  358. //
  359. // keep reference
  360. //
  361. pTerminal->AddRef();
  362. //
  363. // insert item
  364. //
  365. TreeView_InsertItem(
  366. ghSelectedWnd,
  367. &tvi
  368. );
  369. //
  370. // free name
  371. //
  372. SysFreeString( bstrName );
  373. //
  374. // select
  375. //
  376. SelectFirstItem(
  377. ghSelectedWnd,
  378. ghSelectedRoot
  379. );
  380. }