Is it possible to close a windows folder from C#?

  • Thread starter Thread starter Valerie Hough
  • Start date Start date
V

Valerie Hough

I would like to be able to determine if a given folder is open on a user's
desktop, and be able to close it. Is this possible?

Thanks in advance,
Valerie Hough
 
Hello Valerie,

use FindWindow() and SendMessage() with WM_CLOSE WinAPI functions
See www.pinvoke.net about the samples of how to call unmanaged api

VH> I would like to be able to determine if a given folder is open on a
VH> user's desktop, and be able to close it. Is this possible?
VH>
VH> Thanks in advance,
VH> Valerie Hough
---
WBR, Michael Nemtsev [C# MVP]
my blog: http://spaces.live.com/laflour
my team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
Thank you very much for your reply. I found out one interesting thing:
SendMessage did not result in closing the folder (Windows XP), but
PostMessage did. Nevertheless, your response was invaluable in fixing my
problem.
Regards,
Valerie Hough
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top