i have noticed, that SHBrowseForFolder creates a thread but doesn't end it after the dialog closes. so when i let a user browse for a folder via SHBrowseForFolder, there'll be an "unnessecary" thread till the program terminates. is that normal, that SHBrowseForFolder does not end its thread after the dialog closes (the user presses ok or cancel), or is that another strange thing that happens only in my program?

if it is normal, are you allowed to terminate that thread after the dialog closes, or will you have to live with it?
Posted on 2002-01-22 05:58:58 by darester
This sounds like a weird little bug... where do you see the extra
thread? In the general machine-wide amount of threads, or in the
amount of threads in your process? Also, will *each* call to SHBlah
create a new thread, or only the first?
Posted on 2002-01-22 08:03:59 by f0dder
SHBrowseForFolder will create a thread when it's called the first time. this thread will remain till the main program terminates. Further calls to SHBrowseForFolder won't create additional threads.
if you call SHBrowseForFolder 1+ times, you'll have exactly 1 additional thread till the program terminates.

I see this additional thread in a spy program (spy++ which is shipped with vc++).
Posted on 2002-01-22 10:23:00 by darester
Okay. Sounds a bit weird, dunno why SHBlah needs the extra thread.
But since it's only one extra thread in total, I guess it's not too bad?
Posted on 2002-01-22 10:27:03 by f0dder
I think the same thing happens when calling the htmlhelp functions. First my program takes 1.9MB of memory, when it opens it's helpfile and closes it again, it takes 5.7MB.

Posted on 2002-01-22 10:27:36 by Thomas
HtmlHelp pulls in a lot of COM stuff iirc. SHBrowseForFolder might
do the same. But still, creation of an extra thread? I've gotten quite
curious as to what this thread is created for :).
Posted on 2002-01-22 10:31:23 by f0dder