parent windows from DLL

  • Thread starter Thread starter Rajko
  • Start date Start date
R

Rajko

I need to send refresh message to Windows Explorer from shell
extension(DLL).
But I dont know how to obtain handle to Windows Explorer from within DLL
since i dont have any handle to any window.

Thanks, Rajko
 
I need to send refresh message to Windows Explorer from shell
extension(DLL).
But I dont know how to obtain handle to Windows Explorer from within DLL
since i dont have any handle to any window.

Rajko,

What are you doing that requires refreshing Explorer?

Have a look at SHChangeNotify I suspect that's most likely what you
need.

Dave
 
I'm working on program for renaming files. And when I rename file
"small.txt" to "SMALL.txt" Windows Explorer does not refresh window.
So, I want to send refresh message to Windows Explorer window. Or better
Windows Explorer list control.
But I dont know hoe to obtain WE handle. :-(

Rajko
 
I'm working on program for renaming files. And when I rename file
"small.txt" to "SMALL.txt" Windows Explorer does not refresh window.
So, I want to send refresh message to Windows Explorer window. Or better
Windows Explorer list control.
But I dont know hoe to obtain WE handle. :-(

Have you tried using SHChangeNotify?

Dave
 
This is interesting.
First I tried SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH, OldFileName,
NULL);
well... items renamed just dissapeared .... (on F5 they reaper renamed)
Then I found solution thx to Dave :
SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH, OldFileName, NewFileName);

BTW I was convinced that I need to use PostMessage() and got stuck with it.

Thanks, Dave.
 
I noticed strange behaviour.
When I use it on max 5 files at once it works (all 5 files are updated),
but with 6 files nothing happens (not even one file is updated)?!

Rajko.
 
It could be fixed with SHCNF_FLUSH flag but it slowes down process much.
Flag SHCNF_FLUSHNOWAIT does not work since it is closed loop and message
loop can not process sent messages.

Rajko.
 
I noticed strange behaviour.
When I use it on max 5 files at once it works (all 5 files are updated),
but with 6 files nothing happens (not even one file is updated)?!

Doesn't the whole folder get updated - eventually?

Here's a quote from an old post on the subject by Raymond Chen [MS]
about the multiple notifications issue:

"If you send a lot of file update notifications, they get combined
into a single "directory update" notification, and Explorer refreshes
the entire directory - so the operation still succeeds; the items you
sent notifications on did get updated. (as did a bunch of files that
you didn't send notifications on, but no harm done there)
"

.... so if this isn't happening, it's presumably a bug/quirk in the
shell. Which OS versions have you tested with? Are all OS's behaving
the same?

Dave
 
Well, I Win XP pro v2002 SP1 and all updates available from SP2 on windows
update site.
Got .NET framework 1.1.
I tested od dir C:\Tmp\Test 100 and I heve there files:
copy (10) of empty.txt
copy (11) of empty.txt
copy (12) of empty.txt
copy (13) of empty.txt
copy (14) of empty.txt
copy (15) of empty.txt
copy (16) of empty.txt
copy (17) of empty.txt
copy (18) of empty.txt
copy (19) of empty.txt
copy (20) of empty.txt
copy (21) of empty.txt
_cczsd.asd
_cczsd.qwe

the last two have Croatian letters for test purpose.
If I update first 5 copy... they are updated, but when I try first 6
nothing.
I use flag SHCNF_FLUSHNOWAIT in every call and only every 5th SHCNF_FLUSH
which wait for shell to process messages. That is only way it works.
I tryed renaming 400 files "copy of..." and they were only 400 in that dir
just with SHCNF_FLUSHNOWAIT and nothing happened after renaming to UPPERCASE
letters. When I pushed F5 it was all there, renamed.

Rajko.
PS I will test it on few other machines and then post message here.


----- Original Message -----
From: "David Lowndes" <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vc
Sent: Friday, April 23, 2004 4:16 PM
Subject: Re: parent windows from DLL

I noticed strange behaviour.
When I use it on max 5 files at once it works (all 5 files are updated),
but with 6 files nothing happens (not even one file is updated)?!

Doesn't the whole folder get updated - eventually?

Here's a quote from an old post on the subject by Raymond Chen [MS]
about the multiple notifications issue:

"If you send a lot of file update notifications, they get combined
into a single "directory update" notification, and Explorer refreshes
the entire directory - so the operation still succeeds; the items you
sent notifications on did get updated. (as did a bunch of files that
you didn't send notifications on, but no harm done there)
"

... so if this isn't happening, it's presumably a bug/quirk in the
shell. Which OS versions have you tested with? Are all OS's behaving
the same?

Dave
 
Back
Top