Windows NT 4.0 source code leak
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.

1675 lines
43 KiB

4 years ago
  1. 'TB BVT
  2. '
  3. ' WARNING: This is a piece of junk. No warrantee implied.
  4. 'spaghetti, not authored by me, just scribbled by me, (ajohnh, some time in '95)
  5. '$INCLUDE 'c:\msdev\include\RECORDER.INC'
  6. '$include 'c:\msdev\include\winapi.inc'
  7. '$INCLUDE 'c:\MSDEV\INCLUDE\TBPOKE.H'
  8. '//////////////////////////////////////////
  9. '////// borrowed from my in-work TBPoke:
  10. 'logging
  11. global sOutLogName as string
  12. global sScriptName as string
  13. global sComment as string
  14. global hwndViewport as long
  15. global lCountSpace as long
  16. global lCountFunc as long
  17. global lCountTab as long
  18. global MAX_BLANK as long
  19. global sFuncString as string
  20. 'end reporting
  21. global sEndingMessage as string
  22. global sEndTitle as string
  23. 'checkbox function
  24. global sCheckbox as string
  25. global lState as long
  26. 'system metrics
  27. global ScreenX as long
  28. global ScreenY as long
  29. 'time value
  30. global MY_TIMEOUT as long
  31. global PACER as long
  32. global PARAMS as long
  33. global NOPARAMS as long
  34. global hwndTapiControl as hwndTAPI_CONTROL
  35. global ScenarioLog as LOGINITSTRUCT
  36. global sdwPrivileges as array of string
  37. global sPrivileges as string
  38. global sdwMediaModes as array of string
  39. global sMediaModes as string
  40. '
  41. global hLineApp as array of string
  42. global hLine as array of string
  43. global hCall as array of string
  44. redim sdwPrivileges(1 to 3) as string
  45. redim sdwMediaModes(1 to 14) as string
  46. global sdwNumRings as string
  47. redim hLineApp(1 to 5) as string 'limit 5 for now
  48. redim hLine(1 to 5) as string
  49. redim hCall(1 to 5) as string
  50. 'redim hCall(5) as string
  51. global hLineAppIndex as pointer to string
  52. global slpszDestAddress as string
  53. 'counts
  54. global ldwPrivilegesBitFlag as long
  55. global ldwMediaModesBitFlag as long
  56. global ldwPrivilegesBitFlagChaos as long
  57. global ldwMediaModesBitFlagChaos as long
  58. global lLineApp as long
  59. global lLine as long
  60. global lCall as long
  61. global GenCount as long
  62. global lCountLineApp as long
  63. global GenCount2 as long
  64. global OutCount as long 'benchmarker
  65. 'coverage statistics
  66. 'not yet implemented
  67. global TapiStatistic as TAPI_STATISTIC
  68. global Tracelevel as long 'debug output
  69. global Benchmark as long 'benchmarker
  70. 'duh
  71. hwndTapiControl.TapiHandle = WFndWnd("TAPI32 Browser", FW_DEFAULT) 'find TAPI32 BROWSER
  72. 'by ID, note VT will probably be using the decimal form throughout:
  73. hwndTapiControl.ParamsCheckbox =&h000003f9
  74. hwndTapiControl.LineAppPlusButton =&h000003ee
  75. hwndTapiControl.LineAppMinusButton =&h000003ef
  76. hwndTapiControl.LinePlusButton =&h000003f0
  77. hwndTapiControl.LineMinusButton =&h000003f1
  78. hwndTapiControl.CallPlusButton =&h000003f2
  79. hwndTapiControl.CallMinusButton =&h000003f3
  80. hwndTapiControl.PhoneAppPlusButton =&h000003f4
  81. hwndTapiControl.PhoneAppMinusButton =&h000003f5
  82. hwndTapiControl.PhoneOpenPlusButton =&h000003f6
  83. hwndTapiControl.PhoneOpenMinusButton =&h000003f7
  84. hwndTapiControl.ClearEditButton =&h000003f8
  85. hwndTapiControl.BlankButton0 =&h000003fa
  86. hwndTapiControl.BlankButton1 =&h000003fb
  87. hwndTapiControl.BlankButton2 =&h000003fc
  88. hwndTapiControl.BlankButton3 =&h000003fd
  89. hwndTapiControl.BlankButton4 =&h000003fe
  90. hwndTapiControl.BlankButton5 =&h000003ff
  91. hwndTapiControl.Listbox0 =&h000003e8 'middle box
  92. hwndTapiControl.Listbox1 =&h000003e9 'left box
  93. hwndTapiControl.Editbox =&h000003eb 'right box
  94. '// assign
  95. sOutLogName=curdir$ + "\tapibvt.log"
  96. lCountSpace=0
  97. lCountFunc=0
  98. lCountTab=1
  99. MAX_BLANK=20 'static
  100. 'const MY_TIMOUT=2*Benchmark '//THIS IS DEFINED AFTER BENCHMARK//
  101. PACER = 1
  102. PARAMS=1
  103. NOPARAMS=0
  104. const BUSYLINE="9,5569440" 'ISDN, switch will report busy
  105. const ANSWERLINE="9,9366991" 'ITG dial-up modem pool
  106. const NOLINE=" "
  107. const sOutBenchName="benchmrk.txt" 'benchmarker
  108. 'debug; 0=no debug; 3 low, 2 med, 1 high --I know it is backward
  109. Tracelevel=0
  110. ScreenX=GetSystemMetrics(SM_CXSCREEN)
  111. ScreenY=GetSystemMetrics (SM_CYSCREEN)
  112. ScenarioLog.LogOutputType = LogTypeFile
  113. ScenarioLog.MinDetailLevel = 3
  114. ScenarioLog.ProductVersion = "4"
  115. ScenarioLog.MachineName = "Undefined"
  116. ScenarioLog.LogLocation = "tapibvt.log"
  117. ScenarioLog.Language = "US English"
  118. 'WATCH IT
  119. 'dwPrivileges string in the form of sdwPrivileges
  120. 'change these to pointers ASAP
  121. global NONE as long, MONITOR as long, OWNER as long
  122. sdwPrivileges(1)="NONE"
  123. NONE=1
  124. sdwPrivileges(2)="MONITOR"
  125. MONITOR=2
  126. sdwPrivileges(3)="OWNER"
  127. OWNER=3
  128. 'dwMediaModes string in the form of sdwMediaModes
  129. 'edit this, this is bulky & hacked:
  130. global UNKNOWN as long, INTERACTIVEVOICE as long, AUTOMATEDVOICE as long
  131. global DATAMODEM as long, G3FAX as long, TDD as long, G4FAX as long
  132. global DIGITALDATA as long, TELETEX as long, VIDEOTEX as long
  133. global TELEX as long, MIXED as long, ADSI as long, VOICEVIEW as long
  134. sdwMediaModes(1)="UNKNOWN"
  135. UNKNOWN=1
  136. sdwMediaModes(2)="INTERACTIVEVOICE"
  137. INTERACTIVEVOICE=2
  138. sdwMediaModes(3)="AUTOMATEDVOICE"
  139. AUTOMATEDVOICE=3
  140. sdwMediaModes(4)="DATAMODEM"
  141. DATAMODEM=4
  142. sdwMediaModes(5)="G3FAX"
  143. G3FAX=5
  144. sdwMediaModes(6)="TDD"
  145. TDD=6
  146. sdwMediaModes(7)="G4FAX"
  147. G4FAX=7
  148. sdwMediaModes(8)="DIGITALDATA"
  149. DIGITALDATA=8
  150. sdwMediaModes(9)="TELETEX"
  151. TELETEX=9
  152. sdwMediaModes(10)="VIDEOTEX"
  153. VIDEOTEX=10
  154. sdwMediaModes(11)="TELEX"
  155. TELEX=11
  156. sdwMediaModes(12)="MIXED"
  157. MIXED=12
  158. sdwMediaModes(13)="ADSI"
  159. ADSI=13
  160. sdwMediaModes(14)="VOICEVIEW"
  161. VOICEVIEW=14
  162. dim StartTime as long 'for benchmarker
  163. dim EndTime as long
  164. '/////////////////////////////////
  165. '/////// END HEADER /////////////
  166. '/////////////////////////////////
  167. 'prototypes
  168. 'lineInitialze()
  169. 'lineShutdown(hLineApp)
  170. 'lineOpen(hLineApp, dwDeviceID, lphLine, APIVersion, dwExtVersion, dwCallbackInstance, dwPrivileges, dwMediaModes, lpCallParams)
  171. '
  172. 'BENCHMARKER 'hack hack hack
  173. 'delete benchmark file
  174. if exists(sOutLogName) then
  175. kill sOutLogName
  176. end if
  177. 'timer is double precision
  178. if exists(sOutBenchName) then
  179. kill sOutBenchName
  180. end if
  181. StartTime=timer
  182. for OutCount=1 to 100
  183. PerfBox(str$(OutCount))
  184. GenTimeOut(str$(OutCount))
  185. next OutCount
  186. EndTime=timer
  187. Benchmark=Endtime-StartTime
  188. GenTimeOut("Benchmark: " + str$(Benchmark))
  189. StatusBox Close
  190. if Benchmark > 3 then
  191. msgbox "YOUR SYSTEM REALLY SUCKS." + chr$(010) + chr$(010) + "Please use a faster system.", MB_OK OR MB_ICONEXCLAMATION, "Slow Bench Warning"
  192. end if
  193. function GenTimeOut(OutCount as string) 'generate/generic file-i/o
  194. Open sOutBenchName for append as #1
  195. print #1, OutCount + chr$(009) ' + time
  196. Close #1
  197. end function
  198. function PerfBox(OutCount as string)
  199. StatusBox "Profiling System Performance..." + chr$(010) + OutCount,0,0,300,100,TRUE,TRUE,"Courier",8,400
  200. end function
  201. '// set timout, now that we have benched
  202. MY_TIMEOUT = 2 + (2 * Benchmark)
  203. '//END BENCHMARKER
  204. viewport on
  205. viewport clear
  206. on KeyPress (27,FSHIFT) call KeyPressHandler
  207. sub KeyPressHandler (notification_data AS VARIANT)
  208. statusbox close
  209. 'idyes:6 & idno:7
  210. msgbox "Stop tests?", MB_YESNO OR MB_ICONQUESTION OR MB_DEFBUTTON2, "Interruption"
  211. if idyes then
  212. statusbox close
  213. EndMsg()
  214. End
  215. end if
  216. end sub
  217. ' // Run things
  218. StartApps()
  219. if WMenuExists ("&Options\Log &structures\by n&one", MY_TIMEOUT) then
  220. WMenuSelect("&Options\Log &structures\by n&one", MY_TIMEOUT)
  221. endif
  222. 'do these after apps are running, duh
  223. hwndViewport = WFndWnd("Visual Test Viewport",FW_DEFAULT)
  224. GenOut("Getting Some")
  225. hwndTapiControl.TapiHandle= WFndWnd("TAPI32 Browser", FW_DEFAULT) 'find TAPI32 BROWSER
  226. 'by ID, note VT will probably be using the decimal form throughout:
  227. WSetActWnd (hwndTapiControl.TapiHandle)
  228. 'maximize window so button clicks work
  229. 'WMaxWnd (hwndTapiControl.TapiHandle)
  230. GenOut("Logfile= " + chr$(009) + curdir$+sOutLogName)
  231. if Tracelevel > 2 then
  232. GenOut("TAPI Browser handle= " + hex$(hwndTapiControl.TapiHandle))
  233. GenOut("GetProcessHeap(): " + hex$(GetProcessHeap()))
  234. GenOut("GetCurrentProcess(): " + hex$(GetCurrentProcess()))
  235. GenOut("GetCurrentProcessID(): " + hex$(GetCurrentProcessID()))
  236. GenOut("GetThread(): " + chr$(009) + hex$(GetCurrentThread()))
  237. GenOut("GetCurrentThreadID(): " + hex$(GetCurrentThreadID()))
  238. end if
  239. GenOut(chr$(010)+chr$(010)+chr$(010))
  240. WSetActWnd (hwndTapiControl.TapiHandle)
  241. 'ensure edit box is clean
  242. WButtonClick( _id(hwndTapiControl.ClearEditButton), MY_TIMEOUT ) 'do not uncheck this
  243. '********************
  244. 'START YOUR ENGINES
  245. 'lineGetProviderList()
  246. WSetActWnd (hwndTapiControl.TapiHandle) 'scatter a few of these since ESP steals focus
  247. 'End Scenario
  248. '********************
  249. '********************
  250. FUNKY:
  251. Scenario "lineMakeCall (stuff)"
  252. Box("lineMakeCall (verify busy)")
  253. GenOut("Scenario:" + chr$(009) + "lineMakeCall (verify busy)")
  254. lLineApp=1
  255. lLine=1
  256. lCall=1
  257. lineInitialize(lLineApp)
  258. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  259. lineMakeCall(lLine, lCall, BUSYLINE) 'doing this stranglely for now
  260. lineDrop(lCall)
  261. lineDeallocateCall(lCall)
  262. 'lineClose(lLine)
  263. 'lineShutdown(lLineApp)
  264. Box("lineMakeCall, (status)")
  265. GenOut ("Scenario:" + chr$(009) + "lineMakeCall, (status)")
  266. 'line should be open from earlier routine
  267. 'lineInitialize(lLineApp)
  268. 'lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  269. lineMakeCall(lLine, lCall, ANSWERLINE) 'doing this stranglely for now
  270. lineGetNewCalls(lLine)
  271. lineGetAddressStatus(lLine)
  272. lineGetCallInfo(lCall)
  273. lineGetCallStatus(lCall)
  274. lineSetAppSpecific(lCall)
  275. lineDrop(lCall)
  276. lineGetCallInfo(lCall)
  277. lineGetCallStatus(lCall)
  278. lineDeallocateCall(lCall)
  279. Box("lineMakeCall, (lineGetAppSpecific)")
  280. GenOut ("Scenario:" + chr$(009) + "lineMakeCall, (lineGetAppSpecific)")
  281. lineMakeCall(lLine, lCall, ANSWERLINE)
  282. lineDrop(lCall)
  283. lineDeallocateCall(lCall)
  284. Box("lineMakeCall, (Null lpszDestAddress)")
  285. GenOut ("Scenario:" + chr$(009) + "lineMakeCall, (Null lpszDestAddress)")
  286. lineMakeCall(lLine, lCall, NOLINE)
  287. lineDial(lCall, ANSWERLINE)
  288. lineDrop(lCall)
  289. lineDeallocateCall(lCall)
  290. lineClose(lLine)
  291. lineShutdown(lLineApp)
  292. End Scenario
  293. '********************
  294. '********************
  295. Scenario "lineGetAddressCaps (default)"
  296. Box("lineGetAddressCaps (default)")
  297. GenOut("Scenario:" + chr$(009) + "lineGetAddressCaps (default)")
  298. lLineApp=1
  299. lLine=1
  300. lCall=1
  301. lineInitialize(lLineApp)
  302. lineGetAddressCaps(lLineApp)
  303. lineShutdown(lLineApp)
  304. End Scenario
  305. '********************
  306. '********************
  307. Scenario "lineGetAddressID (default)"
  308. Box("lineGetAddressID (default)")
  309. GenOut("Scenario:" + chr$(009) + "lineGetAddressID (default)")
  310. lLineApp=1
  311. lLine=1
  312. lCall=1
  313. lineInitialize(lLineApp)
  314. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  315. lineGetAddressID(lLine)
  316. lineClose(lLine)
  317. lineShutdown(lLineApp)
  318. End Scenario
  319. '********************
  320. '********************
  321. Scenario "lineGetAddressStatus (default)"
  322. Box("lineGetAddressStatus (default)")
  323. GenOut("Scenario:" + chr$(009) + "lineGetAddressStatus (default)")
  324. lLineApp=1
  325. lLine=1
  326. lCall=1
  327. lineInitialize(lLineApp)
  328. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  329. lineGetAddressStatus(lLine)
  330. lineClose(lLine)
  331. lineShutdown(lLineApp)
  332. End Scenario
  333. '********************
  334. '********************
  335. Scenario "lineGetDevConfig (default)"
  336. Box("lineGetDevConfig (default)")
  337. GenOut("Scenario:" + chr$(009) + "lineGetDevConfig (default)")
  338. lLineApp=1
  339. lLine=1
  340. lCall=1
  341. lineInitialize(lLineApp)
  342. lineGetDevConfig() 'no arguments, yet
  343. lineShutdown(lLineApp)
  344. End Scenario
  345. '********************
  346. '********************
  347. Scenario "lineGetDevCaps (default)"
  348. Box("lineGetDevCaps (default)")
  349. GenOut("Scenario:" + chr$(009) + "lineGetDevCaps (default)")
  350. lLineApp=1
  351. lLine=1
  352. lCall=1
  353. lineInitialize(lLineApp)
  354. lineGetDevCaps(lLineApp)
  355. lineShutdown(lLineApp)
  356. End Scenario
  357. '********************
  358. '********************
  359. Scenario "lineGetID (default)"
  360. Box("lineGetID (default)")
  361. GenOut("Scenario:" + chr$(009) + "lineGetID (default)")
  362. lLineApp=1
  363. lLine=1
  364. lCall=1
  365. lineInitialize(lLineApp)
  366. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  367. lineGetID(lLine)
  368. lineShutdown(lLineApp) 'will close too
  369. End Scenario
  370. '********************
  371. '********************
  372. Scenario "lineGetLineDevStatus (default)"
  373. Box("lineGetLineDevStatus (default)")
  374. GenOut("Scenario:" + chr$(009) + "lineGetLineDevStatus (default)")
  375. lLineApp=1
  376. lLine=1
  377. lCall=1
  378. lineInitialize(lLineApp)
  379. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  380. lineGetLineDevStatus(lLine)
  381. lineShutdown(lLineApp) 'will close too
  382. End Scenario
  383. '********************
  384. '********************
  385. Scenario "lineGetNewCalls (default)"
  386. Box("lineGetNewCalls (default)")
  387. GenOut("Scenario:" + chr$(009) + "lineGetNewCalls (default)")
  388. lLineApp=1
  389. lLine=1
  390. lCall=1
  391. lineInitialize(lLineApp)
  392. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  393. lineGetNewCalls(lLine)
  394. lineShutdown(lLineApp) 'will close too
  395. End Scenario
  396. '********************
  397. '********************
  398. Scenario "lineGetNumRings (default)"
  399. Box("lineGetNumRings (default)")
  400. GenOut("Scenario:" + chr$(009) + "lineGetNumRings (default)")
  401. lLineApp=1
  402. lLine=1
  403. lCall=1
  404. lineInitialize(lLineApp)
  405. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  406. lineGetNumRings(lLine)
  407. lineShutdown(lLineApp) 'will close too
  408. End Scenario
  409. '********************
  410. '********************
  411. Scenario "lineGetStatusMessages (default)"
  412. Box("lineGetStatusMessages (default)")
  413. GenOut("Scenario:" + chr$(009) + "lineGetStatusMessages (default)")
  414. lLineApp=1
  415. lLine=1
  416. lCall=1
  417. lineInitialize(lLineApp)
  418. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  419. lineGetStatusMessages(lLine)
  420. lineShutdown(lLineApp) 'will close too
  421. End Scenario
  422. '********************
  423. '********************
  424. Scenario "lineHold (default)"
  425. Box("lineHold (default)")
  426. GenOut("Scenario:" + chr$(009) + "lineHold (default)")
  427. lLineApp=1
  428. lLine=1
  429. lCall=1
  430. lineInitialize(lLineApp)
  431. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  432. lineMakeCall(lLine, lCall, ANSWERLINE) 'doing this stranglely for now
  433. lineHold(lCall)
  434. lineDrop(lCall)
  435. lineDeallocateCall(lCall)
  436. lineClose(lLine)
  437. lineShutdown(lLineApp)
  438. End Scenario
  439. '********************
  440. '********************
  441. Scenario "lineSetNumRings (default)"
  442. Box("lineSetNumRings (default)")
  443. GenOut("Scenario:" + chr$(009) + "lineSetNumRings (default)")
  444. lLineApp=1
  445. lLine=1
  446. lCall=1
  447. sdwNumRings="9"
  448. lineInitialize(lLineApp)
  449. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  450. lineSetNumRings(lLine, sdwNumRings)
  451. lineShutdown(lLineApp) 'will close too
  452. End Scenario
  453. '********************
  454. '********************
  455. '********************
  456. '********************
  457. '********************
  458. '********************
  459. ENDME:
  460. 'END 'END 'END
  461. '********************
  462. '********************
  463. 'lineInitialize with one good pass, then individual null params
  464. Scenario "lineInitialize (many)"
  465. Box("lineInitialize (many)")
  466. WSetActWnd (hwndTapiControl.TapiHandle) 'freshen
  467. for lLineApp= 0 to 4
  468. CallAPI("lineInitialize",0)
  469. next lLineApp
  470. End Scenario
  471. '********************
  472. '********************
  473. 'Scenario "lineGetTranslateCaps"
  474. 'Box("lineGetTranslate")
  475. ' lineGetTranslateCaps()
  476. 'End Scenario
  477. '********************
  478. '********************
  479. Scenario "lineShutdown (many)"
  480. Box("lineShutdown (many)")
  481. for lLineApp= 0 to 4 'note # of lineInitializes, I was too lazy to set a constant for limit
  482. MiddleSelect()
  483. CallAPI("lineShutdown",0)
  484. next lLineApp
  485. End Scenario
  486. '********************
  487. '********************
  488. Scenario "lineNegotiateAPIVersion (valid)"
  489. Box("lineNegotiateAPIVersion (valid)")
  490. '*** disable params, lineInitialize, lineNegotiateAPIVersion with valids, lineShutdown
  491. 'disable params child
  492. CallAPI("lineInitialize",0)
  493. MiddleSelect()
  494. CallAPI("lineNegotiateAPIVersion",0)
  495. MiddleSelect()
  496. CallAPI("lineShutdown",0)
  497. End Scenario
  498. '********************
  499. '********************
  500. Scenario "lineNegotiateAPIVersion (invallow_valhi)"
  501. Box("lineNegotiateAPIVersion (invallow_valhi)")
  502. '*** disable params, lineInitialize
  503. '*** enable params, lineNegotiateAPIVersion with invallow and valhi
  504. '*** disable params, lineShutdown
  505. 'no params
  506. CallAPI("lineInitialize",0)
  507. CallAPI("lineNegotiateAPIVersion",1)
  508. SelectParam("dwAPILowVersion")
  509. SetParamValue("Invalid")
  510. SelectParam("dwAPIHighVersion")
  511. SetParamValue("Valid")
  512. HitOK()
  513. MiddleSelect()
  514. CallAPI("lineShutdown",0)
  515. End Scenario
  516. '********************
  517. Scenario "lineNegotiateAPIVersion (vallow_invalhi)"
  518. Box("lineNegotiateAPIVersion (vallow_invalhi)")
  519. '*** disable params, lineInitialize
  520. '*** enable params, lineNegotiateAPIVersion with vallow and invalhi
  521. '*** disable params, lineShutdown
  522. 'need params
  523. CallAPI("lineInitialize",0)
  524. CallAPI("lineNegotiateAPIVersion",1)
  525. SelectParam("dwAPILowVersion")
  526. SetParamValue("Invalid")
  527. SelectParam("dwAPIHighVersion")
  528. SetParamValue("Valid")
  529. HitOK()
  530. MiddleSelect()
  531. CallAPI("lineShutdown",0)
  532. End Scenario
  533. '********************
  534. '********************
  535. Scenario "lineNegotiateAPIVersion (invallow_invalhi)"
  536. Box("lineNegotiateAPIVersion (invallow_invalhi)")
  537. '*** disable params, lineInitialize
  538. '*** enable params, lineNegotiateAPIVersion with invallow and invalhi
  539. '*** disable params, lineShutdown
  540. 'no params
  541. CallAPI("lineInitialize",0)
  542. CallAPI("lineNegotiateAPIVersion",1)
  543. SelectParam("dwAPILowVersion")
  544. SetParamValue("Invalid")
  545. SelectParam("dwAPIHighVersion")
  546. SetParamValue("Invalid")
  547. HitOK()
  548. MiddleSelect()
  549. CallAPI("lineShutdown",0)
  550. End Scenario
  551. '********************
  552. '********************
  553. Scenario "lineNegotiateAPIVersion_invaldev"
  554. Box("lineNegotiateAPIVersion (invaldev)")
  555. '*** disable params, lineInitialize
  556. '*** enable params, lineNegotiateAPIVersion with invalid device
  557. '*** disable params, lineShutdown
  558. CallAPI("lineInitialize",0)
  559. CallAPI("lineNegotiateAPIVersion",1)
  560. SelectParam("dwDeviceID")
  561. SetParamValue("Invalid")
  562. HitOK()
  563. MiddleSelect()
  564. CallAPI("lineShutdown",0)
  565. End Scenario
  566. '********************
  567. '********************
  568. Scenario "lineNegotiateExtVersion"
  569. Box("lineNegotiateExtVersion")
  570. '*** disable params, lineInitialize
  571. '*** enable params, lineNegotiateExtVersion
  572. '*** disable params, lineShutdown
  573. 'no params
  574. CallAPI("lineInitialize",0)
  575. CallAPI("lineNegotiateExtVersion",0)
  576. MiddleSelect()
  577. CallAPI("lineShutdown",0)
  578. End Scenario
  579. '********************
  580. '********************
  581. '*** disable params, lineInitialize
  582. '*** enable params, lineOpen with privilege
  583. '*** disable params, lineShutdown
  584. Scenario "linOpen_privileges (none)"
  585. Box("linOpen_privileges (none)")
  586. CallAPI("lineInitialize",0)
  587. CallAPI("lineOpen",1)
  588. SelectParam("dwPrivileges")
  589. SelectBitFlag("None")
  590. HitOK()
  591. MiddleSelect()
  592. CallAPI("lineShutdown",0)
  593. End Scenario
  594. '********************
  595. '********************
  596. '*** disable params, lineInitialize
  597. '*** enable params, lineOpen with privilege
  598. '*** disable params, lineShutdown
  599. Scenario "linOpen_privileges (monitor)"
  600. Box("linOpen_privileges (monitor)")
  601. CallAPI("lineInitialize",0)
  602. CallAPI("lineOpen",1)
  603. SelectParam("dwPrivileges")
  604. SelectBitFlag("Monitor")
  605. HitOK()
  606. MiddleSelect()
  607. CallAPI("lineShutdown",0)
  608. End Scenario
  609. '********************
  610. '********************
  611. '*** disable params, lineInitialize
  612. '*** enable params, lineOpen with privilege
  613. '*** disable params, lineShutdown
  614. Scenario "linOpen_privileges (owner)"
  615. Box("linOpen_privileges (owner)")
  616. CallAPI("lineInitialize",0)
  617. CallAPI("lineOpen",1)
  618. SelectParam("dwPrivileges")
  619. SelectBitFlag("Owner")
  620. HitOK()
  621. MiddleSelect()
  622. CallAPI("lineShutdown",0)
  623. End Scenario
  624. '********************
  625. '********************
  626. Scenario "linOpen_privileges (multi)"
  627. Box("linOpen_privileges (multi)")
  628. CallAPI("lineInitialize",0)
  629. CallAPI("lineOpen",1)
  630. SelectParam("dwPrivileges")
  631. SelectBitFlag("None")
  632. HitOK()
  633. CallAPI("lineOpen",1)
  634. SelectParam("dwPrivileges")
  635. SelectBitFlag("Monitor")
  636. HitOK()
  637. CallAPI("lineOpen",1)
  638. SelectParam("dwPrivileges")
  639. SelectBitFlag("Owner")
  640. HitOK()
  641. MiddleSelect()
  642. CallAPI("lineShutdown",0)
  643. End Scenario
  644. '********************
  645. '********************
  646. '*** BEGIN dwPrivileges, dwMediaModes strobing
  647. '*** WATCH THIS: LOOP
  648. '********************
  649. '********************
  650. '*** disable params, lineInitialize
  651. '*** enable params, lineOpen with defaults
  652. '*** disable params, lineShutdown
  653. 'five times
  654. for lLineApp = 0 to 4
  655. Scenario "lineOpen_MediaModes, sdwPrivileges, dwMediaModes.DATAMODEM (TB default)"
  656. Box("lineOpen_MediaModes, dwPrivileges.NONE, dwMediaModes.DATAMODEM (TB default)")
  657. CallAPI("lineInitialize",0)
  658. CallAPI("lineOpen",0) 'defaults are dwPrivileges.NONE, dwMediaModes.DATAMODEM
  659. CallAPI("lineShutdown",0)
  660. End Scenario
  661. next lLineApp
  662. '********************
  663. '********************
  664. '*** matrix privileges and MediaModes (STRAIGHT THROUGH)
  665. '*** dwMediaModes strobing
  666. '*** [attemts most combos]
  667. for ldwPrivilegesBitFlag = 1 to 3
  668. 'dwPrivileges string in the form of sdwPrivileges
  669. for ldwMediaModesBitFlag = 1 to 14
  670. 'one day, change this to a cleaner array
  671. '********************
  672. Scenario "lineOpen_MediaModes, (STRAIGHT THROUGH) " + sdwPrivileges(ldwPrivilegesBitFlag) + ", " + sdwMediaModes(ldwMediaModesBitFlag)
  673. Box("lineOpen_MediaModes, (STRAIGHT THROUGH) " + sdwPrivileges(ldwPrivilegesBitFlag) + ", " + sdwMediaModes(ldwMediaModesBitFlag))
  674. 'This is a workaround to bypass the TAPI for NT hanging problem.
  675. CallAPI("lineInitialize",0)
  676. CallAPI("lineOpen",1)
  677. SelectParam("dwPrivileges")
  678. SelectBitFlag(sdwPrivileges(1)) 'clear default NONE (1)
  679. SelectBitFlag(sdwPrivileges(ldwPrivilegesBitFlag)) 'set Bit flag
  680. SelectParam("dwMediaModes")
  681. SelectBitFlag(sdwMediaModes(4)) 'clear default DATAMODEM (4)
  682. SelectBitFlag(sdwMediaModes(ldwMediaModesBitFlag))
  683. HitOK()
  684. MiddleSelect() 'just select anything in the list box
  685. CallAPI("lineShutdown",0)
  686. End Scenario
  687. next ldwMediaModesBitFlag
  688. next ldwPrivilegesBitFlag
  689. '********************
  690. '********************
  691. '*** END dwMediaModes (STRAIGHT THROUGH)
  692. '********************
  693. '********************
  694. '********************
  695. '********************
  696. goto SKIPCHAOS
  697. '********************
  698. '********************
  699. '*** matrix privileges and MediaModes (CHAOTIC)
  700. '*** dwMediaModes strobing
  701. '*** [try simultaneous operations]
  702. CHAOS:
  703. for GenCount=1 to 200
  704. 'not used: randomize TIMER 'for "bound-ed" chaos
  705. '********************
  706. Scenario ("lineOpen_MediaModes, (CHAOTIC)")
  707. Box("lineOpen_MediaModes, (CHAOTIC)")
  708. 'do 5
  709. for lLineApp= 0 to 4
  710. LineInitialize(lLineApp) 'returns hLineApp(lLineApp)
  711. next lLineApp
  712. 'begin Chaos translation here so I may retain my pretty matrix blocks & to increase hits
  713. for lLineApp=0 to 4
  714. GenChaos() 'all globals
  715. SelectLineApp(lLineApp)
  716. CallAPI("lineOpen",1)
  717. SelectParam("dwPrivileges")
  718. SelectBitFlag(sdwPrivileges(1)) 'clear default NONE (1)
  719. SelectBitFlag(sdwPrivileges(ldwPrivilegesBitFlagChaos)) 'set Bit flag
  720. SelectParam("dwMediaModes")
  721. SelectBitFlag(sdwMediaModes(4)) 'clear default DATAMODEM (4)
  722. SelectBitFlag(sdwMediaModes(ldwMediaModesBitFlagChaos))
  723. HitOK()
  724. next lLineApp
  725. 'cleanup, do 5
  726. 'WILL NOT WORK WITHOUT HANDLES
  727. for lLineApp= 0 to 4
  728. LineShutdown(lLineApp)
  729. next lLineApp
  730. End Scenario
  731. next GenCount
  732. '********************
  733. '********************
  734. '*** END dwMediaModes (CHAOTIC)
  735. '********************
  736. '********************
  737. '********************
  738. '********************
  739. SKIPCHAOS:
  740. '********************
  741. '********************
  742. '********************
  743. '********************
  744. '********************
  745. '********************
  746. '*** disable params, lineInitialize
  747. '*** enable params, lineOpen with privilege
  748. '*** disable params, lineShutdown
  749. Scenario "linOpen_MediaModes (privileges_multi)"
  750. Box("linOpen_MediaModes (privileges_multi)")
  751. CallAPI("lineInitialize",0)
  752. 'as owner
  753. CallAPI("lineOpen",1)
  754. SelectParam("dwPrivileges")
  755. SelectBitFlag("Owner")
  756. SelectParam("dwMediaModes")
  757. SelectBitFlag("DATAMODEM")
  758. HitOK()
  759. CallAPI("lineOpen",1)
  760. SelectParam("dwPrivileges")
  761. SelectBitFlag("Owner")
  762. SelectParam("dwMediaModes")
  763. SelectBitFlag("TELETEX")
  764. HitOK()
  765. CallAPI("lineOpen",1)
  766. SelectParam("dwPrivileges")
  767. SelectBitFlag("Owner")
  768. SelectParam("dwMediaModes")
  769. SelectBitFlag("TELEX")
  770. HitOK()
  771. CallAPI("lineOpen",1)
  772. SelectParam("dwPrivileges")
  773. SelectBitFlag("Owner")
  774. SelectParam("dwMediaModes")
  775. SelectBitFlag("INTERACTIVEVOICE")
  776. HitOK()
  777. MiddleSelect()
  778. CallAPI("lineShutdown",0)
  779. End Scenario
  780. '///////////////
  781. ' *************************
  782. ' ***** END TEST CASE *****
  783. ' *************************
  784. '///////
  785. '///////
  786. '///////
  787. '***** END END END END END END *****
  788. StatusBox Close
  789. EndMsg()
  790. End
  791. '********************
  792. '********************
  793. JUNKY:
  794. Scenario "Call Unimplemented APIs"
  795. Box("Call Unimplemented APIs")
  796. GenOut("Scenario:" + chr$(009) + "Call Unimplemented APIs")
  797. 'CallAPI("lineAddToConference",0) 'requires two calls on one line
  798. lLineApp=1
  799. lLine=1
  800. lCall=1
  801. lineInitialize(lLineApp)
  802. lineOpen(lLineApp, lLine, sdwPrivileges(OWNER), sdwMediaModes(DATAMODEM)) 'doing this stranglely for now
  803. lineMakeCall(lLine, lCall, BUSYLINE) 'doing this stranglely for now
  804. CallAPI("lineBlindTransfer",0) 'requires call
  805. CallAPI("lineCompleteCall",0) 'requires call
  806. 'CallAPI("lineCompleteTransfer",0) 'requires two calls on one line
  807. CallAPI("lineDevSpecific",0) 'requires line
  808. CallAPI("lineDevSpecificFeature",0) 'requires line
  809. CallAPI("lineForward",0) 'requires line
  810. CallAPI("lineGatherDigits",0) 'requires call
  811. CallAPI("lineGenerateDigits",0) 'requires call
  812. CallAPI("lineGenerateTone",0) 'requires call
  813. lineDrop(lCall)
  814. lineDeallocateCall(lCall)
  815. CallAPI("lineGetConfRelatedCalls",0)
  816. CallAPI("lineGetRequest",0)
  817. CallAPI("lineMonitorDigits",0)
  818. CallAPI("lineMonitorMedia",0)
  819. CallAPI("lineMonitorTones",0)
  820. CallAPI("lineNegotiateExtVersion",0)
  821. CallAPI("linePark",0)
  822. CallAPI("linePickup",0)
  823. CallAPI("linePrepareAddToConference",0)
  824. CallAPI("lineRedirect",0)
  825. CallAPI("lineRegisterRequestRecipient",0)
  826. CallAPI("lineRemoveFromConference",0)
  827. CallAPI("lineSecureCall",0)
  828. CallAPI("lineSendUserUserInfo",0)
  829. CallAPI("lineSetAppSpecific",0)
  830. CallAPI("lineSetTerminal",0)
  831. CallAPI("lineSetTollList",0)
  832. CallAPI("lineSetupConference",0)
  833. CallAPI("lineSetupTransfer",0)
  834. CallAPI("lineSwapHold",0)
  835. CallAPI("lineUncompleteCall",0)
  836. CallAPI("lineUnhold",0)
  837. CallAPI("lineUnpark",0)
  838. End Scenario
  839. '********************
  840. '********************
  841. '********************
  842. '********************
  843. '********************
  844. '********************
  845. '********************
  846. '********************
  847. '********************
  848. '********************
  849. 'Scenario "lineClose"
  850. '
  851. 'do not need params
  852. 'SetCheckboxControl(_id(hwndTapiControl.ParamsCheckbox),0)
  853. 'MiddleSelect()
  854. 'SelectParam("lineClose")
  855. 'play "{ENTER}"
  856. '
  857. 'CaptureEdit()
  858. '
  859. 'End Scenario
  860. '
  861. '/**************************************************/
  862. 'FUNCTIONS
  863. 'Outputs, identical until global architecture change
  864. function GenOut(sFuncString as string) 'generate/generic file-i/o
  865. ' // open logging file
  866. box("Calling: " + sFuncString)
  867. Open sOutLogName for append as #1
  868. print #1, sFuncString + chr$(009) ' + time
  869. print hwndViewport, sFuncString + chr$(009) '+ time
  870. Close #1
  871. end function
  872. function GenOutFunc(sFuncString as string) 'generate file-i/o of current function
  873. ' // open logging file
  874. box ("Calling: " + sFuncString)
  875. Open sOutLogName for append as #1
  876. print #1, sFuncString + chr$(009) + time
  877. print hwndViewport, sFuncString + chr$(009) + time
  878. Close #1
  879. end function
  880. 'for TBPoke only: GetFunc runs the state core, remember to trim tabs
  881. ' this was from TBPoke, but it has been modified not to look for script file
  882. function GetFunc (sFuncString as string)
  883. sFuncString=""
  884. 'count the entries
  885. lCountFunc=lCountFunc+1
  886. sFuncString=trim$(sFuncString,009) 'trim tabs
  887. sFuncString=trim$(sFuncString," ") 'whatever MST calls a space
  888. sFuncString=trim$(sFuncString,255) 'trim truespace
  889. if sFuncString=chr$(000) then sFuncString="COMMENT" 'ASCII null
  890. end function
  891. 'Check for runaway file i/o read; consider it "IsCarriageReturn"
  892. function IsRunaway(sFuncString as string) as string
  893. if sFuncString="" then
  894. lCountSpace=lCountSpace+1 'begin counting blank entries
  895. if lCountSpace=MAX_BLANK then sFuncString="END"
  896. else
  897. lCountSpace=0
  898. end if
  899. end function
  900. 'Find comments
  901. function IsComment(sFuncString as string) as string
  902. select case(ucase$(left$(sFuncString,1)))
  903. case ";"
  904. sFuncString="COMMENT"
  905. case "#"
  906. sFuncString="COMMENT"
  907. case "'"
  908. sFuncString="COMMENT"
  909. case ""
  910. sFuncString="COMMENT"
  911. 'IsRunaway(sFuncString) 'count blanks to prevent infinite loop
  912. 'GenOut(sFuncString, hwndViewport)
  913. end select
  914. 'find other comments
  915. select case(left$(sFuncString,2))
  916. case "//"
  917. sFuncString="COMMENT"
  918. end select
  919. 'find more comments, I know it is not model code, shut up
  920. select case(left$(sFuncString,4))
  921. case "REM " 'with space
  922. sFuncString="COMMENT"
  923. end select
  924. end function 'IsComment
  925. 'toggle checkbox state, will leave focus on sCheckbox
  926. function SetCheckboxControl(sCheckbox as string, lState as long) as long
  927. select case(lState)
  928. case 0
  929. If WCheckState(sCheckbox) = CHECKED then
  930. WCheckUnCheck(sCheckbox,MY_TIMEOUT)
  931. if Tracelevel>=3 then GenOut ("Unchecking checkbox "+sCheckbox)
  932. else
  933. if Tracelevel>=2 then GenOut ("Error: Attempt to WCheckUnCheck() unchecked checkbox "+sCheckbox)
  934. end if
  935. case 1
  936. If WCheckState(sCheckbox) = UNCHECKED then
  937. WCheckCheck(sCheckbox,MY_TIMEOUT)
  938. if Tracelevel>=3 then GenOut ("Checking checkbox "+sCheckbox)
  939. else
  940. if Tracelevel>=2 then GenOut ("Error: Attempt to WCheckCheck() checked checkbox "+sCheckbox)
  941. end if
  942. end select
  943. end function
  944. function HitOK() 'hits the OK button
  945. WButtonClick( "OK", MY_TIMEOUT)
  946. CaptureEdit()
  947. end function
  948. function CallAPI(sFuncString as string, lState as long)
  949. if lState > 1 then GenOut("Error: lState is exceeds value of 1.")
  950. GenOut("API:" + chr$(009) + sFuncString)
  951. SetCheckboxControl(_id(hwndTapiControl.ParamsCheckbox),lState)
  952. WListItemClk(_id(hwndTapiControl.Listbox1), sFuncString, MY_TIMEOUT)
  953. play "{ENTER}"
  954. if lState=0 then CaptureEdit() 'so calling the API w/ default params gens output & HitOK gens output (see HitOK())
  955. end function
  956. function SelectParam(sFuncString as string)
  957. GenOut("Parameter:" + chr$(009) + sFuncString)
  958. WListFind ("Parameters:", MY_TIMEOUT)
  959. WListItemDblClk("Parameters:", sFuncString, MY_TIMEOUT)
  960. end function
  961. function SetParamValue(sFuncString as string)
  962. GenOut("Parameter Value:" + chr$(009) + sFuncString)
  963. WEditSetFocus("Value:", MY_TIMEOUT)
  964. select case(ucase$(sFuncString))
  965. case ucase$("Null")
  966. play "00000000"
  967. case ucase$("Valid") 'WATCH THIS: dankn often displays English here
  968. 'leave it alone, default is VALID or valid value
  969. 'play "{DOWN}"
  970. 'play "{DOWN}"
  971. case ucase$("Invalid")
  972. play "ffffffff"
  973. case else
  974. GenOut("Error: Bad SetParamValue() parameter: " + sFuncstring)
  975. end select
  976. end function
  977. 'global ParamValue as string 'put this at front
  978. 'function SetParamValue(sFuncString as string,ParamValue as string)
  979. ' SelectParam(sFuncString as string)
  980. function SelectBitFlag(sFuncString as string)
  981. GenOut("Select Bit Flag: " + sFuncString)
  982. 'lineOpen has defaults: dwPrivileges.NONE, dwMediaModes.DATAMODEM
  983. WListFind ("Bit flags:", MY_TIMEOUT)
  984. WListItemDblClk("Bit flags:", sFuncString, MY_TIMEOUT)
  985. 'BitFlag[] sFuncString ;;;; soon add cleanup structure
  986. end function
  987. function EndMsg()
  988. sEndingMessage="TB BVT ended."
  989. sEndTitle="Completed"
  990. msgbox sEndingMessage, MB_OK, sEndTitle
  991. end function
  992. function CaptureEdit()
  993. 'play "{ENTER}" 'assuming child window is in focus and OK button is selected
  994. 'GenOut("******************** TAPI Report ********************")
  995. 'GenOut(ListText(_id(hwndTapiControl.Listbox0), MY_TIMEOUT))
  996. sleep 0.1 'take an i/o break
  997. GenOut("TAPI Browser reports: ")
  998. GenOut(EditText(_id(hwndTapiControl.Editbox) + chr$(010), MY_TIMEOUT))
  999. 'GenOut("******************** END REPORT *********************" + chr$(010) + chr$(010))
  1000. WButtonClick(_id(hwndTapiControl.ClearEditButton), MY_TIMEOUT)
  1001. end function
  1002. '>>++++
  1003. function MiddleSelect() 'not yet: sFuncString as string 'selects last item in .Listbox0
  1004. WListSetFocus(_id(hwndTapiControl.Listbox0), MY_TIMEOUT)
  1005. 'not yet: WListItemDblClk(_id(hwndTapiControl.Listbox0), sFuncString, MY_TIMEOUT)
  1006. play "{PGDN}"
  1007. end function
  1008. function lineGetProviderList()
  1009. CallAPI("lineGetProviderList",0)
  1010. end function
  1011. function lineGetTranslateCaps()
  1012. CallAPI("lineGetTranslateCaps",0)
  1013. Box("Dumping buffer")
  1014. sleep 1
  1015. Box("Dumping buffer")
  1016. sleep 1
  1017. end function
  1018. function Box(sFuncString as string)
  1019. 'disabled, bug in statusbox is stealing focus
  1020. 'StatusBox sFuncString + chr$(009),ScreenX-300,ScreenY-75,300,75,FALSE,FALSE,"Courier",8,400
  1021. end function
  1022. 'function SelectLineApp(lLineApp as long) 'machine
  1023. ' 'later revise to allow real-time monitor of handles
  1024. ' 'select valid lineApp lLineApp, searching top to bottom, exit out having made selection
  1025. ' 'It does look bad. If dankn's conventions stray too far, this will fail
  1026. ' MiddleSelect()
  1027. ' if lLineApp > WListCount(_id(hwndTapiControl.Listbox0), MY_TIMEOUT) then
  1028. ' GenOut("Error: BAD ONE, lLineApp of " + str$(lLineApp) + " exceeding WListCount of " + str$(WListCount(_id(hwndTapiControl.Listbox0), MY_TIMEOUT)))
  1029. ' beep
  1030. ' beep
  1031. ' beep
  1032. ' goto SKIPSelectLineApp
  1033. ' end if
  1034. ' play "{PGUP}"
  1035. ' lCountLineApp=WListCount(_id(hwndTapiControl.Listbox0), MY_TIMEOUT)
  1036. ' for GenCount = 1 to lCountLineApp
  1037. ' 'do not down-arrow yet since first item is selected
  1038. ' sLineApp=ListItemText(_id(hwndTapiControl.Listbox0), WListIndex(_id(hwndTapiControl.Listbox0),MY_TIMEOUT),MY_TIMEOUT)
  1039. ' select case (left$(ucase$(sLineApp),9))
  1040. ' case ucase$("LineApp=x") 'first half matches (this may happen with invalids too, so look on
  1041. ' select case (val(right$(sLineApp,8)))
  1042. ' case 0 'is an invalid, so index
  1043. ' play "{DOWN}"
  1044. ' case else 'hex value is non-zero, let us use it
  1045. ' select case (WListIndex(_id(hwndTapiControl.Listbox0),MY_TIMEOUT))
  1046. ' case (lLineApp) 'is this the index requested?
  1047. ' GenCount=lCountLineApp 'return 'get out, leaving it focused
  1048. ' case else 'is not lLineApp, so index
  1049. ' play "{DOWN}"
  1050. ' end select
  1051. ' end select
  1052. ' case else 'is not "LineApp=x", so index
  1053. ' play "{DOWN}"
  1054. ' end select 'THIS MESS DONE SINCE this shitty beta has horrible if-then nesting errors (not me!)
  1055. ' next GenCount
  1056. ' SKIPSelectLineApp: 'skip if lLineApp is bogus value
  1057. 'end function
  1058. function StartApps()
  1059. run "MTVIEW.EXE", nowait, SW_NORMAL
  1060. hwndViewport = WFndWnd("Visual Test Viewport",FW_DEFAULT,5) 'find Visual Test Viewport
  1061. if hwndViewport = 0 then
  1062. fail "MTVIEW.EXE application failed to start"
  1063. end if
  1064. run "TB20.EXE" , nowait , SW_MAXIMIZE 'NOWAIT SW_NORMAL
  1065. sleep 2
  1066. hwndTapiControl.TapiHandle= WFndWnd("TAPI32 Browser", FW_DEFAULT,5) 'find TAPI32 BROWSER
  1067. if hwndTapiControl.TapiHandle= 0 then
  1068. fail "TB20.EXE application failed to start"
  1069. end if
  1070. end function
  1071. 'not used:
  1072. function StopApps()
  1073. hwndViewport = WFndWnd("Visual Test Viewport", FW_DEFAULT or FW_FOCUS)
  1074. if hwndViewport <> 0 then
  1075. Play "%{F4}" 'alt f4
  1076. end if
  1077. hwndTapiControl.TapiHandle = WFndWnd("TAPI32 Browser", FW_DEFAULT or FW_FOCUS)
  1078. if hwndTapiControl.TapiHandle <> 0 then
  1079. Play "%{F4}" 'alt f4
  1080. end if
  1081. end function
  1082. function GenChaos() 'all globals
  1083. ldwPrivilegesBitFlagChaos=(int(rnd*3)+1)
  1084. ldwMediaModesBitFlagChaos=(int(rnd*14)+1)
  1085. Box("lineOpen_MediaModes, (CHAOS) LineApp " + str$(lLineApp) + ", " + sdwPrivileges(ldwPrivilegesBitFlagChaos) + ", " + sdwMediaModes(ldwMediaModesBitFlagChaos))
  1086. GenOut("lineOpen_MediaModes, (CHAOS)" + str$(ldwPrivilegesBitFlagChaos) +","+ str$(ldwMediaModesBitFlagChaos) + " LineApp " + str$(lLineApp) + ", " + sdwPrivileges(ldwPrivilegesBitFlagChaos) + ", " + sdwMediaModes(ldwMediaModesBitFlagChaos))
  1087. end function
  1088. function lineInitialize(lLineApp as long) 'all globals; stipulate lLineApp for ease of array; for ex: lineInitialize(lLineApp); lLineApp being long
  1089. CallAPI("lineInitialize",0) 'create a LineApp
  1090. 'lineApp is now open...
  1091. CallAPI("lineOpen",1) 'cheat, use TB to provide clean handle
  1092. SelectParam("hLineApp") 'select the hLineApp of Params:
  1093. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1094. hLineApp(lLineApp)=EditText("Value:", MY_TIMEOUT) 'get pointer/handle string
  1095. if Tracelevel >= 1 then GenOut("New hLineApp=" + chr$(009) + hLineApp(lLineApp))
  1096. Abort()
  1097. end function
  1098. function LineShutdown(lLineApp as long) 'all globals
  1099. CallAPI("lineShutdown",1)
  1100. SelectParam("hLineApp")
  1101. WEditSetFocus("Value:", MY_TIMEOUT) 'ready to enter handle
  1102. play hLineApp(lLineApp)
  1103. HitOK()
  1104. end function
  1105. function SelectLineApp(lLineApp as long) 'all globals
  1106. MiddleSelect()
  1107. WListItemClk(_id(hwndTapiControl.Listbox0), "LineApp=x" + (hLineApp(lLineApp)), MY_TIMEOUT)
  1108. end function
  1109. 'not implemented
  1110. function SelectLine(lLine as long) 'all globals; prep for lineMakeCall
  1111. MiddleSelect()
  1112. ' (_id(hwndTapiControl.Listbox0), "Line=x" + (hLineApp(lLineApp)), MY_TIMEOUT)
  1113. end function
  1114. function lineOpen(lLineApp as long, lLine as long, sPrivileges as string, sMediaModes as string)
  1115. CallAPI("lineOpen",1) 'child window is open and focused
  1116. SelectParam("hLineApp")
  1117. WEditSetFocus("Value:", MY_TIMEOUT)
  1118. play hLineApp(lLineApp) 'handle of LineApp
  1119. SelectParam("dwPrivileges")
  1120. GenOut("Clearing default on following line:")
  1121. SelectBitFlag(sdwPrivileges(1)) 'clear default NONE (1)
  1122. SelectBitFlag(sPrivileges) 'set Bit flag
  1123. SelectParam("dwMediaModes")
  1124. GenOut("Clearing default on following line:")
  1125. SelectBitFlag(sdwMediaModes(4)) 'clear default DATAMODEM (4)
  1126. SelectBitFlag(sMediaModes)
  1127. HitOK()
  1128. CallAPI("lineMakeCall",1) 'cheat, use to get hLine value
  1129. SelectParam("hLine")
  1130. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1131. hLine(lLine)=EditText("Value:", MY_TIMEOUT) 'get pointer/handle string
  1132. if Tracelevel >= 1 then GenOut("New hLine=" + chr$(009) + hLine(lLine))
  1133. Abort() 'abort child
  1134. end function
  1135. function lineMakeCall(lLine as long, lCall as long, slpszDestAddress as string)
  1136. CallAPI("lineMakeCall",1) 'child window is open and focused
  1137. SelectParam("hLine")
  1138. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1139. play hLine(lLine) 'specify the handle
  1140. SelectParam("lpszDestAddress")
  1141. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1142. play slpszDestAddress
  1143. WButtonClick( "OK", MY_TIMEOUT)
  1144. sleep 10
  1145. 'hide dialog
  1146. if slpszDestAddress <> " " then
  1147. WButtonFind ( "&Talk", 15) 'use a way to wait for dialog
  1148. WSetActWnd (hwndTapiControl.TapiHandle) 'refocus TB
  1149. sleep 3
  1150. end if
  1151. 'if slpszDestAddress <> " " then
  1152. ' WSetWndPos ( WFndWnd("Call Status", FW_DEFAULT), ScreenX, ScreenY) 'find Call Status window
  1153. ' sleep 15
  1154. 'end if
  1155. 'if slpszDestAddress <> " " then 'being caution of Talk/Hangup dialog
  1156. ' sleep 12
  1157. ' WButtonClick( "&Talk", MY_TIMEOUT + 10)
  1158. 'end if
  1159. '
  1160. CallAPI("lineDrop",1) 'cheat, use to get hCall value
  1161. SelectParam("hCall")
  1162. WEditSetFocus("Value:", MY_TIMEOUT)
  1163. hCall(lCall)=EditText("Value:", MY_TIMEOUT) 'get pointer/handle string
  1164. if Tracelevel >= 1 then GenOut("New hCall=" + chr$(009) + hCall(lCall))
  1165. Abort()
  1166. end function
  1167. function lineDrop(lCall as long)
  1168. CallAPI("lineDrop",1)
  1169. SelectParam("hCall")
  1170. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1171. play hCall(lCall) 'specify the handle
  1172. HitOK()
  1173. end function
  1174. function lineDeallocateCall(lCall as long)
  1175. CallAPI("lineDeallocateCall",1)
  1176. Selectparam("hCall")
  1177. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1178. play hCall(lCall) 'specify handle
  1179. HitOK()
  1180. end function
  1181. 'not implemented; in-work
  1182. function lineAddToConference(lLine as long)
  1183. CallAPI("lineAddToConference",1)
  1184. Selectparam("hLine")
  1185. 'blah
  1186. end function
  1187. function lineAnswer()
  1188. end function
  1189. function Abort()
  1190. play "{ESC}" 'abort child
  1191. GenOut("Aborted child window: OK, probably getting handle here." + chr$(010))
  1192. end function
  1193. 'not implemented
  1194. function CheckErr(TAPIErr as string)
  1195. 'lineAddProvider returned LINEERR_INVALPOINTER
  1196. end function
  1197. function lineClose(lLine)
  1198. CallAPI("lineClose",1)
  1199. SelectParam("hLine")
  1200. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1201. play hLine(lLine) 'specify the handle
  1202. HitOK()
  1203. end function
  1204. function lineGetNewCalls(lLine as long)
  1205. CallAPI("lineGetNewCalls",1)
  1206. SelectParam("hLine")
  1207. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1208. play hLine(lLine) 'specify the handle
  1209. HitOK()
  1210. end function
  1211. function lineGetAddressStatus(lLine as long)
  1212. CallAPI("lineGetAddressStatus",1)
  1213. SelectParam("hLine")
  1214. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1215. play hLine(lLine) 'specify the handle
  1216. HitOK()
  1217. end function
  1218. function lineGetCallInfo(lCall as long)
  1219. CallAPI("lineGetCallInfo", 1)
  1220. SelectParam("hCall")
  1221. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1222. play hCall(lCall) 'specify the handle
  1223. HitOK()
  1224. end function
  1225. function lineGetCallStatus(lCall as long)
  1226. CallAPI("lineGetCallStatus", 1)
  1227. SelectParam("hCall")
  1228. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus, no real reason
  1229. play hCall(lCall) 'specify the handle
  1230. HitOK()
  1231. end function
  1232. function lineSetAppSpecific(lCall as long)
  1233. CallAPI("lineSetAppSpecific", 1)
  1234. SelectParam("hCall")
  1235. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1236. play hCall(lCall) 'specify the handle
  1237. HitOK()
  1238. end function
  1239. function lineDial(lCall as long, slpszDestAddress as string)
  1240. CallAPI("lineDial", 1)
  1241. SelectParam("hCall")
  1242. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1243. play hCall(lCall) 'specify the handle
  1244. SelectParam("lpszDestAddress")
  1245. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1246. play slpszDestAddress
  1247. WButtonClick( "OK", MY_TIMEOUT)
  1248. sleep 5
  1249. 'hide dialog
  1250. WButtonFind ( "&Talk", 15) 'use a way to wait for &Talk dialog
  1251. WSetActWnd (hwndTapiControl.TapiHandle) 'refocus TB
  1252. sleep 1
  1253. 'WButtonClick( "&Talk", MY_TIMEOUT + 10)
  1254. end function
  1255. function lineGetAddressCaps(lLineApp as long)
  1256. CallAPI("lineGetAddressCaps", 1)
  1257. SelectParam("hLineApp")
  1258. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1259. play hLineApp(lLineApp)
  1260. HitOK()
  1261. end function
  1262. function lineGetAddressID(lLine as long)
  1263. CallAPI("lineGetAddressID", 1)
  1264. SelectParam("hLine")
  1265. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1266. play hLine(lLine)
  1267. HitOK()
  1268. end function
  1269. function lineGetDevConfig()
  1270. 'ensure a LineApp is open when calling lineGetDevConfig
  1271. CallAPI("lineGetDevConfig", 0)
  1272. end function
  1273. function lineGetDevCaps(lLineApp as long)
  1274. Box("Dumping buffer")
  1275. CallAPI("lineGetDevCaps", 1)
  1276. SelectParam("hLineApp")
  1277. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1278. play hLineApp(lLineApp)
  1279. HitOK()
  1280. end function
  1281. function lineGetID(lLine as long) 'consider parameter Bit flags here
  1282. CallAPI("lineGetID", 1)
  1283. SelectParam("hLine")
  1284. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1285. play hLine(lLine)
  1286. HitOK()
  1287. end function
  1288. function lineGetLineDevStatus(lLine as long)
  1289. CallAPI("lineGetLineDevStatus", 1)
  1290. SelectParam("hLine")
  1291. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1292. play hLine(lLine)
  1293. HitOK()
  1294. end function
  1295. function lineGetNumRings(lLine as long)
  1296. CallAPI("lineGetNumRings", 1)
  1297. SelectParam("hLine")
  1298. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1299. play hLine(lLine)
  1300. HitOK()
  1301. end function
  1302. function lineGetStatusMessages(lLine as long)
  1303. CallAPI("lineGetStatusMessages", 1)
  1304. SelectParam("hLine")
  1305. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1306. play hLine(lLine)
  1307. HitOK()
  1308. end function
  1309. function lineHold(lCall as long)
  1310. CallAPI("lineHold", 1)
  1311. SelectParam("hCall")
  1312. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1313. play hCall(lCall)
  1314. HitOK()
  1315. end function
  1316. function lineSetNumRings(lLine as long, sdwNumRings as string)
  1317. CallAPI("lineSetNumRings", 1)
  1318. SelectParam("hLine")
  1319. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1320. play hLine(lLine)
  1321. SelectParam("dwNumRings")
  1322. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1323. play sdwNumRings
  1324. HitOK()
  1325. end function
  1326. function lineSetStatusMessages(lLine as long)
  1327. CallAPI("lineSetStatusMessages", 1)
  1328. SelectParam("hLine")
  1329. WEditSetFocus("Value:", MY_TIMEOUT) 'set focus
  1330. play hLine(lLine)
  1331. HitOK()
  1332. end function
  1333. 'truly the end