wintrek.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. '$INCLUDE 'varlist.inc'
  2. '
  3. ' Type declarations
  4. '
  5. '
  6. ' Variable declarations
  7. '
  8. GLOBAL mVTVList as VTVariableList
  9. GLOBAL mVTEdit as LONG
  10. SUB WintrekInit()
  11. VTVLInit(mVTVList)
  12. mVTEdit = 0
  13. END SUB
  14. SUB WintrekTerm()
  15. VTVLTerm(mVTVList)
  16. END SUB
  17. SUB WintrekRefreshVariableList()
  18. DIM strVTText as STRING
  19. DIM strTitle as STRING
  20. DIM strValue as STRING
  21. DIM dwIndex as LONG
  22. '
  23. ' Make sure we have found the edit control.
  24. '
  25. IF (0 = mVTEdit) THEN
  26. mVTEdit = WFndWndC("Version=", "Edit", FW_HIDDENOK OR FW_NOFOCUS OR FW_ALL OR FW_PREFIX, 10)
  27. END IF
  28. IF (0 <> mVTEdit) THEN
  29. '
  30. ' Get the text from the control.
  31. '
  32. strVTText = GetText(mVTEdit)
  33. IF ("" <> strVTText) THEN
  34. '
  35. ' Update our list.
  36. '
  37. VTVLClear(mVTVList)
  38. DO
  39. dwIndex = INSTR(strVTText, "=")
  40. IF (0 <> dwIndex) THEN
  41. '
  42. ' We found the equal sign.
  43. '
  44. strTitle = LEFT(strVTText, dwIndex - 1)
  45. strVTText = MID(strVTText, dwIndex + 1)
  46. dwIndex = INSTR(strVTText, ",")
  47. if (0 <> dwIndex) THEN
  48. strValue = LEFT(strVTText, dwIndex - 1)
  49. strVTText = MID(strVTText, dwIndex + 1)
  50. ELSE
  51. strValue = strVTText
  52. strVTText = ""
  53. END IF
  54. VTVLAddValue(mVTVList, strTitle, strValue)
  55. ELSE
  56. '
  57. ' There's no equal sign. This is an error.
  58. '
  59. strVTText = ""
  60. END IF
  61. LOOP WHILE (Len(strVTText) > 0)
  62. END IF
  63. END IF
  64. END SUB
  65. FUNCTION WintrekGetString(strTitle as STRING, strValue as STRING) as LONG
  66. WintrekRefreshVariableList()
  67. WintrekGetString = VTVLGetStringValue(mVTVList, strTitle, strValue)
  68. END FUNCTION
  69. FUNCTION WintrekGetLong(strTitle as STRING, dwValue as LONG) as LONG
  70. WintrekRefreshVariableList()
  71. WintrekGetLong = VTVLGetLongValue(mVTVList, strTitle, dwValue)
  72. END FUNCTION
  73. FUNCTION WintrekWaitForString(strTitle as STRING, strValue as STRING, csecWait as LONG) as LONG
  74. DIM strNewValue as STRING
  75. WintrekWaitForString = 0
  76. DO
  77. WintrekRefreshVariableList()
  78. IF (1 = WintrekGetString(strTitle, strNewValue)) THEN
  79. IF (strNewValue = strValue) THEN
  80. WintrekWaitForString = 1
  81. EXIT DO
  82. END IF
  83. END IF
  84. IF (cSecWait > 0) THEN
  85. SLEEP 1
  86. csecWait = cSecWait - 1
  87. END IF
  88. LOOP WHILE(csecWait > 0)
  89. END FUNCTION
  90. FUNCTION WintrekWaitForLong(strTitle as STRING, dwValue as LONG, csecWait as LONG) as LONG
  91. DIM dwNewValue as LONG
  92. WintrekWaitForLong = 0
  93. DO
  94. WintrekRefreshVariableList()
  95. IF (1 = WintrekGetLong(strTitle, dwNewValue)) THEN
  96. IF (dwNewValue = dwValue) THEN
  97. WintrekWaitForLong = 1
  98. EXIT DO
  99. END IF
  100. END IF
  101. IF (cSecWait > 0) THEN
  102. SLEEP 1
  103. csecWait = cSecWait - 1
  104. END IF
  105. LOOP WHILE(csecWait > 0)
  106. END FUNCTION