Q
qingrj
Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个托盘小程序,用起来效果不错,现在我想让它Hint动态显示所读注册表的键值.<br>我在大富翁论坛研究了一个周的帖子,总是不得其法,先将原码贴上来,请高人点化.<br>在线等待,只UP无分.<br><br>unit acbb;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> ExtCtrls, StdCtrls,shellapi, Menus, Registry;<br><br>const IDI_TRAYICON=WM_USER+10;<br> TRAY_CALLBACK=WM_USER+40;<br><br>type<br> TForm1 = class(TForm)<br> label1: TPanel;<br> PopupMenu1: TPopupMenu;<br><br> N1: TMenuItem;<br> A1: TMenuItem;<br> N2: TMenuItem;<br> X1: TMenuItem;<br> H1: TMenuItem;<br> Timer1: TTimer;<br> procedure FormCreate(Sender: TObject);<br> procedure A1Click(Sender: TObject);<br> procedure X1Click(Sender: TObject);<br> procedure H1Click(Sender: TObject);<br> procedure N1Click(Sender: TObject);<br> procedure FormPaint(Sender: TObject);<br> procedure Timer1Timer(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br>var<br> MyRegistry:TRegistry;<br> Form1: TForm1;<br> aa:TNotifyIcondata;<br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var tubiao:THandle;<br>begin<br> tubiao:=application.Icon.handle;<br> aa.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;<br> aa.uID:=uint(IDI_TRAYICON);<br> aa.cbSize:=sizeof(tnotifyicondata);<br> aa.uCallbackMessage:=tray_callback;<br> aa.Wnd:=self.handle;<br> aa.hIcon:=tubiao;<br> //aa.sztip:='请右键选择';<br> shell_notifyicon(nim_add,@aa);<br> showwindow(application.handle,sw_hide);<br> form1.caption:='电脑开机时间为:'+timetostr(now);<br>end;<br>procedure TForm1.A1Click(Sender: TObject);<br>var msg:string;<br>begin<br> msg:='xxxxxxxxxxxxx'; <br> application.MessageBox(pchar(msg),'关于...',mb_ok+mb_iconinformation);<br>end;<br><br><br>procedure TForm1.X1Click(Sender: TObject);<br>begin<br> form1.close;<br> form1.Free;<br>end;<br><br>procedure TForm1.H1Click(Sender: TObject);<br>begin<br> myregistry:=Tregistry.Create;<br> MyRegistry.RootKey:=HKEY_LOCAL_MACHINE;<br> try<br> if MyRegistry.OpenKey('/SOFTWARE/d-ok',True)<br> then<br> begin<br> MyRegistry.writebool('xxhg',true);<br> MyRegistry.writestring('jls[0]',datetimetostr(now));<br> end;<br> finally<br> MyRegistry.Free;<br> end;<br> winexec('C:/Program Files/b-d/eye.exe',SW_RESTORE) ;<br>end;<br><br>procedure TForm1.N1Click(Sender: TObject);<br>begin<br> winexec('C:/Program Files/b-d/b-d.exe',SW_RESTORE) ;<br>end;<br><br>procedure TForm1.FormPaint(Sender: TObject);<br>begin<br> Form1.Hide;<br>end;<br>{procedure TForm1.Timer1Timer(Sender: TObject);<br>var tipinfo,info:string;<br>begin<br>myregistry:=Tregistry.Create;<br> MyRegistry.RootKey:=HKEY_LOCAL_MACHINE;<br> try<br> if MyRegistry.OpenKey('/SOFTWARE/d-ok',True)<br> then tnnd:= '现在数据是:'+inttostr(MyRegistry.Readinteger('tnnd'));<br> finally<br> MyRegistry.Free;<br> end;<br><br> {这里如何显示tnnd值,请高人点化}<br><br>end;}<br><br>end.