绝对高难!!!请问怎样控制修改Windows的开始按钮的图标和文字?(200分)

  • 主题发起人 主题发起人 trybird
  • 开始时间 开始时间
T

trybird

Unregistered / Unconfirmed
GUEST, unregistred user!
看了很多修改Windows开始按钮的例子。但如何实现的呢?<br><br>参见http://homepage1.nifty.com/kazubon/tclock/indexzh-cn.html<br><br>还有http://www.ec-learn.com/gb/zpxz<br><br>Super BobiBar (快捷工具栏V2.08) 424KB <br>最新版的Super BobiBar, 快捷方式及网址管理工具。加强了图标管理功能。新加入工具栏按钮显示方式。打开图标和分类管理功能更方便。<br>访问常用网址,一点即得。<br>可将快捷图标、网址、E-mail地址统统分类收入在一起的一个快捷按钮管理工具,可直接将文件或网址拖入工具栏,创建快捷方式非常方便。非常 Cool 的用户界面,方便你快速启动应用程序、快速访问常用网站。<br>可以控制Windows的"开始"按钮图标,控制Windows本身的应用程序工具条。<br>可控制显示或禁止桌面及桌面图标<br>可控制禁止关闭Windows系统。禁止Windows系统功能键<br>用户可自由设置工具栏属性。如显示方式、按钮方式等。提供单色,渐变,图片填充等图示方式。 <br><br>还有http://download.lycos.com.cn/soft_tools/windowsqjgjl.html<br><br>软件名称:Windows 快捷工具栏 [国产] <br>软件授权:免费软件<br>注册费用:<br>使用平台:WIN95/98/NT<br>软件开发:HomePage <br>&nbsp;<br>软件简介:<br>  1. 最新版的Super BobiBar, 非常好用的 Windows 快捷方式及网址管理工具。加强了图标管理功能。新加入工具栏按钮显示方式。打开图标和分类管理功能更方便。<br>  2. 提供上千种分类精彩网址供选择,访问常用网址,一点即得。<br>  3.可将快捷图标、网址、E-mail地址统统分类收入在一起的一个快捷按钮管理工具,可直接将文件或网址拖入工具栏,创建快捷方式非常方便。非常 Cool 的用户界面,方便你快速启动应用程序、快速访问常用网站。<br>  4.可以控制Windows的”开始”按钮图标,控制Windows本身的应用程序工具条。<br>  5.可控制显示或禁止桌面及桌面图标。<br>  6.可控制禁止关闭Windows系统。禁止Windows系统功能键。<br>  7.用户可自由设置工具栏属性。如显示方式、按钮方式等。提供单色,渐变,图片填充等图示方式。<br>  8.其他更多功能。!!!!值得一试。。。 <br>&nbsp;<br>
 
可以试试修改explorer.exe这个文件的资源
 
做广告??????
 
我看也是做广告。<br>怎么给分呢?!
 
不是!<br>兄弟们误解了!<br>我找了好些资料,只是怎样把开始按钮因隐藏或屏蔽掉。<br>而这些我n年前就知道了,而怎样修改它的图标,我确实还不会。<br>用SendMessage()或PostMessage()发BM_SetImage消息都改变不了它的位图,只能把它隐掉,所以求贤!非做广告也!<br><br>SendMessage(StartButtonHandle,BM_SetImage,IMAGE_BITMAP,MyImage.Bitmap.Handle);<br><br>请教过一些高手,答曰:根本不可能!但我上面举了很多例子,人家能作到的,我们为什么……?
 
SendMessage(StartButtonHandle,BM_SetImage,IMAGE_BITMAP,MyImage.Bitmap.Handle);<br>这样是绝对不可行的,StartButtonHandle与MyImage处于不同进程
 
这有何难,你给多少分?呵呵!别说换图,就是玩特效也不过如此!原理说穿了就很简单!<br>先用FindWindowEx找到句柄,然后在窗体创建事件中加入CreateFrames创建Canvas,<br>再调用BuildFrames,就可以通过BitBlt随意画,最后要记得DestroyFrames(其实就是释放Buffer)喔!<br>以上Frames相关的都是自定义过程,无非是创建位图等相关内容。<br>关键就是利用Frames过程画图。当然你利用StretchBlt函数代替也可以,不过速度慢些,而且特效也玩得不多。<br>举个用StretchBlt实现的简例:首先在FormCreate事件中通过<br>starthd =: FindWindow("Shell_TrayWnd", nil); &nbsp;//获得任务栏窗口句柄<br>starthd =: FindWindowEx(starthd, HWND(0), "Button", nil); &nbsp;//获得开始按钮窗口句柄<br>然后通过startButton =: GetDC(starthd); &nbsp;//获得位图句柄<br>starthd =: GetDesktopWindow(); <br>yourDesktop =: GetDC(starthd); &nbsp;//获得桌面窗口句柄<br>好了,现在可以在ButtonClick中添加画图事件了。<br>StretchBlt(startButton,0,0,60,25,yourDesktop,0,0,60,25,srccopy); &nbsp;//绘制位图到开始按钮上<br>最后退出用ReleaseDC释放位图句柄即可。<br>OK,清者自清,至言无言。
 
run the code bwlow<br><br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; ExtCtrls, StdCtrls, GIFImage;<br><br>const<br>MAX_BUFFER =10;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; Timer1: TTimer;<br>&nbsp; &nbsp; Image1: TImage;<br>&nbsp; &nbsp; Edit1: TEdit;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Timer1Timer(Sender: TObject);<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure FormDestroy(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; &nbsp;public<br>&nbsp; &nbsp; HW : HWND;<br>&nbsp; &nbsp; DC : HDC;<br>&nbsp; &nbsp; R &nbsp;: TRect;<br>&nbsp; &nbsp; FNumber : integer;<br>&nbsp; &nbsp; Buffer : array[1..MAX_BUFFER] of TBitmap;<br>&nbsp; &nbsp; procedure CreateFrames;<br>&nbsp; &nbsp; procedure DestroyFrames;<br>&nbsp; &nbsp; procedure BuildFrames;<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; &nbsp;end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br><br><br><br>procedure TForm1.CreateFrames; <br>var <br>i : integer; <br>begin <br>&nbsp; for i:=1 to MAX_BUFFER do<br>&nbsp; &nbsp;begin <br>&nbsp; &nbsp; &nbsp;Buffer := TBitmap.Create; <br>&nbsp; &nbsp; &nbsp;Buffer.Height := R.Bottom-R.Top; <br>&nbsp; &nbsp; &nbsp;Buffer.Width &nbsp;:= R.Right-R.Left; <br>&nbsp; &nbsp; &nbsp;Buffer.Canvas.Brush.Color := clBtnFace;<br>&nbsp; &nbsp; &nbsp;Buffer.Canvas.Pen.Color := clBtnFace; <br>&nbsp; &nbsp; &nbsp;Buffer.Canvas.Rectangle(0,0,Buffer.Width,Buffer.Height); <br>&nbsp; &nbsp;end; <br>end; <br><br>procedure TForm1.DestroyFrames; <br>var <br>i : integer; <br>begin <br>&nbsp; for i:=1 to MAX_BUFFER do<br>&nbsp; &nbsp;begin <br>&nbsp; &nbsp; &nbsp;Buffer.Destroy; <br>&nbsp; &nbsp;end; <br>end; <br><br>// Prepare animation segments/sprites <br>procedure TForm1.BuildFrames; <br>var <br>i,j,k,H,W : integer; <br>Y : double;<br>begin <br>H := R.Bottom-R.Top; <br>W := R.Right-R.Left;<br>Image1.Width := W;<br>Image1.Height:= H;<br>for i := 1 to MAX_BUFFER-1 do //Buffer[MAX_BUFFER] is used to hold the original bitmap <br>&nbsp; for j:= 1 to W do <br>&nbsp; &nbsp;for k:=1 to H do <br>&nbsp; &nbsp; begin <br>&nbsp; &nbsp; &nbsp;Y := 2*Sin((j*360/W)*(pi/180)-20*i);<br>&nbsp; &nbsp; &nbsp;Buffer.Canvas.Pixels[j,k-Round(Y)]:= Buffer[6].Canvas.Pixels[j,k]; <br>&nbsp; &nbsp; end; <br>end; <br><br><br><br><br>&nbsp;<br><br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>//Get the original button face and will be used later to revert<br>//the start button when animation is done<br>&nbsp; BitBlt(Buffer[MAX_BUFFER].Canvas.Handle,0,0,R.Right-R.Left,R.Bottom-R.Top,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DC,0,0,SRCCOPY);<br>&nbsp; BuildFrames;<br>&nbsp; Image1.Canvas.Draw(0,0,Buffer[MAX_BUFFER]);<br>&nbsp; Button2.Enabled := true;<br>&nbsp; if Edit1.Text &lt;&gt; '' then<br>&nbsp; &nbsp;Timer1.Interval := StrToInt(Edit1.Text)<br>&nbsp; else<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; Timer1.Interval := 100;<br>&nbsp; &nbsp; Edit1.Text := '100';<br>&nbsp; &nbsp;end;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; &nbsp; Timer1.Enabled := not Timer1.Enabled;<br>&nbsp; if not Timer1.Enabled then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;BitBlt(DC,0,0,R.Right-R.Left,R.Bottom-R.Top,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Buffer[MAX_BUFFER].Canvas.Handle,0,0,SRCCOPY);<br>&nbsp; &nbsp; &nbsp;Button2.Caption := '&amp;Animate';<br>&nbsp; &nbsp; &nbsp;Button1.Enabled := true;<br>&nbsp; &nbsp;end<br>&nbsp; else<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;Button2.Caption := '&amp;Stop';<br>&nbsp; &nbsp; &nbsp;Button1.Enabled := false;<br>&nbsp; &nbsp;end;<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br>&nbsp; BitBlt(DC,0,0,R.Right-R.Left,R.Bottom-R.Top, <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Buffer[FNumber].Canvas.Handle,0,0,SRCCOPY);<br>&nbsp; Inc(FNumber);<br>&nbsp; if (FNumber &gt; MAX_BUFFER-1) then FNumber := 1;<br><br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; HW := FindWindowEx(FindWindow('Shell_TrayWnd',nil),0,'Button',nil);<br>&nbsp; GetWindowRect(HW,R);<br>&nbsp; DC := GetWindowDC(HW);<br>&nbsp; CreateFrames;<br>&nbsp; FNumber :=1;<br>end;<br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br>Timer1.Enabled := false; <br>&nbsp; BitBlt(DC,0,0,R.Right-R.Left,R.Bottom-R.Top,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Buffer[MAX_BUFFER].Canvas.Handle,0,0,SRCCOPY);<br>&nbsp; ReleaseDC(HW,DC);<br>&nbsp; DestroyFrames; // don't ever forget to do this !<br>end;<br><br>end.<br><br>
 
trybird<br>不好意思你所说的以上两个软件是在下的倔作。<br>还你认别人误会啦你给我做广告呢。<br><br>在此郑重说明,不要误会。<br><br>你说的问题好像不难实现有空我发个E-Mail给吧
 
var<br>&nbsp;StartButton : hWnd;<br>&nbsp;NewImage &nbsp; &nbsp;: TPicture;<br>begin<br>&nbsp; &nbsp;NewImage := TPicture.create;<br>&nbsp; &nbsp;NewImage.LoadFromFile('C:/Windows/Circles.BMP');<br>&nbsp; &nbsp;StartButton := FindWindowEx (FindWindow('Shell_TrayWnd', nil), 0,'Button', nil);<br>&nbsp; &nbsp;//更改<br>&nbsp; &nbsp;OldBitmap := SendMessage(StartButton, BM_SetImage, 0, NewImage.Bitmap.Handle); <br>&nbsp; //改回<br>&nbsp; SendMessage(StartButton, BM_SetImage, 0, OldBitmap); <br>end;<br>
 
我也很想知道这个问题的答案<br><br>在win2000下,使用setwindowtext无法修改那个按钮的问题,使用<br>SendMessage(StartButton, BM_SetImage, 0, NewImage.Bitmap.Handle)<br>也只是把图片去掉而已<br><br>如果使用GDI来绘制的话,则只要窗口一刷新,效果就没了
 
截获刷新的消息
 
FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0,'Button',nil)<br>获得,开始,按钮的名柄
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部