home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2000 February / PCW_2_2000.ISO / software / sw / notfall / xsetpsdk.exe / examples / testplug checkenum.xpl < prev    next >
Encoding:
Text File  |  1998-09-18  |  1.7 KB  |  72 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 3.1"
  2. "TYPE"="8"
  3. "COUNT"="2"
  4. "UIPATH"="Test Plug-ins"
  5. "NAME"="Enum Test"
  6. "LANGUAGE"="VBScript"
  7. "TEXT 1"="Display"
  8. "TEXT 2"="Remove List"
  9. "DESCRIPTION 1"="This plug-in demonstrates how to use enumeration inside X-Setup and how to use the listbox-plug-in-type."
  10. "DESCRIPTION 2"="It enumartes all keys below "HKCU\Software" and displays them in a listbox."
  11. "DESCRIPTION 3"="If you click "Display" it displays the selected item and if you click "Remove List" the item is removed from the list."
  12. "DESCRIPTION 4"="No changes are made to your system by using this plug-in!"
  13. "AUTHOR"="Xteq Systems"
  14. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  15.  
  16.  
  17. sP="HKCU\Software"
  18. 'Called when the Plugin is started
  19. Sub Plugin_Initialize 
  20.  'start enumeration
  21.  iCount=RegEnumPaths(sp)
  22.  
  23.  'perform a loop through all found items
  24.  for l=1 to iCount
  25.   'get an item
  26.   s=RegEnumElement(l)
  27.   
  28.   'add it to the listbox
  29.   Call SetUIElement(l,s)
  30.  next
  31. End Sub
  32.  
  33.  
  34. Sub Plugin_CheckData(ElementIndex)
  35. End Sub
  36.  
  37. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  38.  
  39.  if ElementIndex=1 then 
  40.   'first button clicked -> display
  41.  
  42.   if ElementSubIndex>0 then
  43.    'get an item and display it
  44.    s=GetUIElement(ElementSubIndex)
  45.    MsgInformation s
  46.    
  47.   else
  48.    'user has not selected anything in the listbox
  49.    MsgError "Please select an item!"
  50.   end if
  51.  
  52.  else
  53.   'second button clicked -> remove
  54.  
  55.   if ElementSubIndex>0 then
  56.    'remove item by setting it to ""
  57.    Call SetUIElement(ElementSubIndex,"")
  58.  
  59.   else
  60.    'user has not selected anything in the listbox
  61.    MsgError "Please select an item!"
  62.   end if
  63.  
  64.  end if
  65. End Sub
  66.  
  67. Sub Plugin_Terminate 
  68. End Sub
  69.  
  70.  
  71.  
  72.