Siegfried Heintze
10/1/2002 4:08:00 PM
(1) Are WNetOpenEnum and WNetEnumResource wrapped or do I have to use
PInvoke?
Since these are extremely slow functions (on a large network, they can take
a minute per function invocation), one would want to call them in a seperate
thread. However, these functions also require precious memory from
GlobalAlloc (does this function require PInvoke too?) so you don't want any
thread exiting prematurely without calling GlobalFree (because image rundown
won't give you this memory back).
(2) What function can I override to detect that the user wants to shut down
the GUI? I need a message handler for WM_NCDESTROY, for example. How can I
write any message handler in C#?
(3) In this function, how can I gracefully block until all the child threads
have successfully called GlobalFree? Since the child threads may have just
started a call to WNetEnumResource, it could be an entire minute until the
child thread receives the suicide note and can come back and respond that
suicide is complete. How can the main thread display a progress control that
is updated 10 times/second while it is responding to WM_NCDESTROY.
(4) How can I implement the child threads as a UI threads that check the
message pump for a custom message (such as a suicide note message) to
determine if the user wants to shut down before they are done enumerating
the network?