Question about NotifyFilters ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • £$%^

    Question about NotifyFilters ?

    Hello group,
    I want to create an array of FileSystemWatch ers. The indices of the
    arrays will be x(PATH) and NotifyFilters, i.e. for every PATH I will be
    able to run one watcher for every NotifyFilters attribute. The first
    question that I have is that NotifyFilters range from 1 to 383 with
    gaps, which means that alot of objects in the array will by empty,
    which will be wasteful. To solve this problem I created a
    "companion" enumeration like so
    (if it was perl, maybe an associative array could have been helpful)

    Enum enum_notify
    filename = 0
    dirname = 1
    attributes = 2
    size = 3
    write = 4
    access = 5
    create = 6
    sec = 8
    End Enum

    Would this be a reasonable design?

    My second question is regarding the above enumeration,
    suppose I want to turn raising events on for all attributes,
    I would need to write something like so

    For i As enum_notify = enum_notify.fil ename To enum_notify.sec
    If enum_notifyfilt er_a And 2 ^ i Then arWatcher(menu. Index,
    i).EnableRaisin gEvents = True
    Next

    The only problem here is that the for loop takes the values
    0,1,2,3,4,5,6,7 ,8, i.e. it will include 7 in the loop whereas
    enum_notify doesn't use 7, and the 2 ^ i "trick" is
    not very elegant. Can I do it in a better way?


  • Andrew Morton

    #2
    Re: Question about NotifyFilters ?

    £$%^" < wrote:
    <wanting to iterate over the values of an enum>



    Andrew


    Comment

    • void

      #3
      Re: Question about NotifyFilters ?

      Hello,

      Yes, this has worked, thank you. Can I ask what does the
      square bracket do in vb - couldn't find it in msdn?


      Comment

      Working...