delphi - IShellFolder with async EnumObject (SHCONTF_ENABLE_ASYNC) -


i'm having pretty abnormal work in application. i'm using following code enumerate namespaces , root namespaces - such nethood work pretty slow - on 1 minute load (!!) happens on win7, on older system loading ok.

i'm using functions, mustangpeak library:

function tnamespace.enumeratefolder(messagewnd: hwnd; folders, nonfolders,   includehidden: boolean; enumfunc: tenumfoldercallback;   userdata: pointer): integer; var   enum: ienumidlist;   flags: longword;   fetched: longword;   item: pitemidlist;   terminate: boolean;   olderror: integer;   oldwow64: pointer; begin   result := 0;    olderror := seterrormode(sem_failcriticalerrors or sem_noopenfileerrorbox);   try     if assigned(shellfolder)     begin       if assigned(enumfunc)       begin         terminate := false;         flags := 0;         if folders           flags := flags or shcontf_folders;         if nonfolders           flags := flags or shcontf_nonfolders;         if includehidden           flags := flags or shcontf_includehidden;      // --- new added     flags := flags or shcontf_enable_async;          if valid         begin           oldwow64 := wow64redirectdisable;           try              if shellfolder.enumobjects(messagewnd, flags, enum) = noerror              begin               // vista enum nil every once in while               if assigned(enum)               begin                 while (enum.next(1, item, fetched) = noerror) , not terminate                 begin                   if enumfunc(messagewnd, item, self, userdata, terminate)                    inc(result)                 end               end             end                       wow64redirectrevert(oldwow64)           end         end       end     end       seterrormode(olderror);   end end; 

now read in msdn doc in win7 new async flag has been supported in order results instantly receive other results when system read it.

that flag called shcontf_enable_async , added in code on place i've marked (// --- new added)

problem because don't know how catch events when receive updates.

how hook on newly received items? there event (message etc.) system (object) sends control or structure etc.

thanks!

shcontf_enable_async not make enumeration asynchronous. lets ishellfolder know monitoring asynchronous change notifications outside of ishellfolder, such shchangenotifyregister(), enumeration not need return @ 1 time change notifications let know when items added/removed/changed in real-time.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -