Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Recycle Bin icon

Posted on 2001-09-05
26
Medium Priority
?
413 Views
Last Modified: 2010-08-05

I want to change Recycle Bin icons!!

i've change it in the registry end if i delete a file
(and restore it) the Recycle Bin icons had changed
the problem is that i don't want to delete a file
but to change the icons otherwise


i've tried to send some messages and succed to change
all other icons (MyComputer,Internet Explorer icons)
but not RecycleBin.
0
Comment
Question by:ntony
  • 11
  • 9
  • 4
  • +1
26 Comments
 
LVL 9

Expert Comment

by:ginsonic
ID: 6459476
listening
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6465614
The value is stored in the registry...

HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon

Empty:
%SystemRoot%\System32\shell32.dll,31

Full:

%SystemRoot%\System32\shell32.dll,32

Change them there and issue a desktop refresh like this:

const WM_REFRESH_DESKTOP = $A065;

  SendMessage(0, WM_COMMAND, WM_REFRESH_DESKTOP, 0);
0
 
LVL 1

Author Comment

by:ntony
ID: 6466608
it's nto working!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 6468980
What OS are you using?

If it is Win2K, we have to try another approach. I have
seen another way of refreshing the desktop but I can not
recall where. I will see if I can find it.

0
 
LVL 1

Author Comment

by:ntony
ID: 6470041
I need it for 95 and 98.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6470341
Can you show the code you are using to modify the icon and
refresh? You say that the icon changes back to the original
after you delete a file?
0
 
LVL 1

Author Comment

by:ntony
ID: 6471148
no, the problem is that after i change the ricycle bin icon the change is shown after i delete a file, and i want that the change to take place right away.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6472682
So you can not show the code, huh? Hmm, makes it hard to
imagine what may be causing your problem.

If you can't help me, I can't help you...
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6472721
Ok, found it...

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, nil, nil);

will invalidate the desktop. it takes a very short time
but it does do it automatically!

0
 
LVL 1

Author Comment

by:ntony
ID: 6472991
it's not working (now i'm running 95)
i've seen a refresh but the recycle bin icon is not changing (after a change the key of course)

i was thinking about this API but with other approche.
(i whant to delete a file send a message, restore the file and send the message again,but is not a good idea)

0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6474452
Hey, I tried it in Win98 and it works. My guess is that YOU are doing something WRONG.

If you can not show how you are doing it, then you are on
your own and anyone else here will tell you the same thing.



0
 
LVL 1

Author Comment

by:ntony
ID: 6474751
i didn't say that ii don't want to show you my code
here it is:

     Reg.WriteString('Shell Icon Size','16');
     SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,SPI_SETICONMETRICS,LPARAM(2));
     Reg.WriteString('Shell Icon Size',IntToStr(count));
     SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,SPI_SETICONMETRICS,LPARAM(2));


it's not cool that's why i esitate to show it to you!
it's working in Win'95 and Win'98
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 400 total points
ID: 6474989
You said you wanted to change the recycle bin icon. The code you show does not do that.

Try this code:

const WM_REFRESH_DESKTOP = $A065;

procedure TForm1.Button1Click(Sender: TObject);
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    // You can try this key, also
    // HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}
    Reg.RootKey := HKEY_CLASSES_ROOT;
    if Reg.OpenKey('\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon', False) then
    begin
      Reg.WriteString('','"%SystemRoot%\System32\shell32.dll,32"');
      Reg.WriteString('Empty','"%SystemRoot%\System32\shell32.dll,32"');
      Reg.WriteString('Full','"%SystemRoot%\System32\shell32.dll,33"');
    end;
  finally
    Reg.CloseKey;
    Reg.Free;
    SendMessage(0, WM_COMMAND, WM_REFRESH_DESKTOP, 0);
    SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, nil, nil);
  end;
end;

You can not change the SIZE of the recycle bin icon
without changing them for every other desktop icon.

0
 

Expert Comment

by:szjozsef
ID: 6478481
EddieShipman's answer is correct.
0
 
LVL 1

Author Comment

by:ntony
ID: 6478482
thanks it's working!
i did something wrong!(i don't no what)
0
 
LVL 1

Author Comment

by:ntony
ID: 6478879
Can you tell me from where do you Know $A065

i whant to know because i want to do the same thing with the strat menu icon
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6479237
That value cames from a book about undocumented Windows API
calls. You can view the value by using Winsight to monitor
windows messages.

There is an article on changing the Startmenu bitmap
on www.delphi3000.com.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6481497
Hi ,

I tested your codeEddie and I try to replace the default icon with mine .

I have replaced


                          Reg.WriteString('','"%SystemRoot%\System32\shell32.dll,32"');
                          Reg.WriteString('Empty','"%SystemRoot%\System32\shell32.dll,32"');
                          Reg.WriteString('Full','"%SystemRoot%\System32\shell32.dll,33"');

with

                          Reg.WriteString('','c:\1.ico"');
                          Reg.WriteString('Empty','"1.ico"');
                          Reg.WriteString('Full','"2.ico"');

The recycleBin icon is replaced but the animation for full-empty don't work . All the time I have just the icon for empty ( in my case 1.ico )
Can you tell me where I wrong ?
0
 
LVL 1

Author Comment

by:ntony
ID: 6481525
i know the registry and i want a const  like $A065
that refresh the menu.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6482603
I see that you did not give the FULL PATH to the icons
in your WriteString calls.

Give that a try...

Refresh what menu?
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6483275
Sorry , in my code is full path .I forgot when I type it .
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6483278
So that isn't the problem on my test :(
0
 

Expert Comment

by:szjozsef
ID: 6483311
EddieShipman : ntony is talking about changing the StartMenu icon and refreshing the StartMenu.

JSz.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6483819
I don't have code to modify the start menu bitmap but I do
know there is some out there.

Do you yet have code to change StartMenu bitmap?

I will have to wait to check my source to modify the
recycle bin icons till I get home tonight. The code I
provided does not work on Win2K, hmmm...

0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 6483901
This is the code I found for changing the Start Menu Bitmap:

procedure TForm1.Button1Click(Sender: TObject);
begin
  NewImage := TPicture.Create;
  NewImage.Bitmap := Image1.Picture.Bitmap;
  case Button1.Tag of
  0:
    begin
      StartButton := FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0,'Button', nil);
      OldBitmap := SendMessage(StartButton, BM_SetImage, 0, NewImage.Bitmap.Handle);
      Button1.Tag := 1;
    end;
  1:
    begin
      SendMessage(StartButton,BM_SetImage,0,OldBitmap);
      Button1.Tag := 0;
    end;
  end;
  NewImage.Free;
end;

Can you post yours?

0
 
LVL 1

Author Comment

by:ntony
ID: 6484794
if i change in the registri a icon inthe start menu and send the message that i show it to you the icon changes.
my question was that i don't want to use this message because it's not very "profesional"
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question