Recycle Bin icon


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.
LVL 1
ntonyAsked:
Who is Participating?
 
Eddie ShipmanConnect With a Mentor All-around developerCommented:
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
 
ginsonicCommented:
listening
0
 
Eddie ShipmanAll-around developerCommented:
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
ntonyAuthor Commented:
it's nto working!
0
 
Eddie ShipmanAll-around developerCommented:
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
 
ntonyAuthor Commented:
I need it for 95 and 98.
0
 
Eddie ShipmanAll-around developerCommented:
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
 
ntonyAuthor Commented:
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
 
Eddie ShipmanAll-around developerCommented:
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
 
Eddie ShipmanAll-around developerCommented:
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
 
ntonyAuthor Commented:
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
 
Eddie ShipmanAll-around developerCommented:
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
 
ntonyAuthor Commented:
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
 
szjozsefCommented:
EddieShipman's answer is correct.
0
 
ntonyAuthor Commented:
thanks it's working!
i did something wrong!(i don't no what)
0
 
ntonyAuthor Commented:
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
 
Eddie ShipmanAll-around developerCommented:
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
 
ginsonicCommented:
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
 
ntonyAuthor Commented:
i know the registry and i want a const  like $A065
that refresh the menu.
0
 
Eddie ShipmanAll-around developerCommented:
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
 
ginsonicCommented:
Sorry , in my code is full path .I forgot when I type it .
0
 
ginsonicCommented:
So that isn't the problem on my test :(
0
 
szjozsefCommented:
EddieShipman : ntony is talking about changing the StartMenu icon and refreshing the StartMenu.

JSz.
0
 
Eddie ShipmanAll-around developerCommented:
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
 
Eddie ShipmanAll-around developerCommented:
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
 
ntonyAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.