Solved

Recycle Bin icon

Posted on 2001-09-05
26
395 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
 
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 100 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now