楼主,我给你源码/ private { Private declarations } ficon:ticon; //定义 nid:tnotifyicondata; public { Public declarations }procedure TForm1.FormCreate(Sender: TObject); begin ficon:=ticon.Create; ficon.Handle:=loadicon(hinstance,'mainicon'); if ficon.Handle=0 then begin messagedlg('不能打开图标!',mtError,[mbOK],0); application.Terminate; exit; end; with nid do begin cbsize:=sizeof(tnotifyicondata); wnd:=handle; uid:=trayiconid; uflags:=nif_message or nif_icon or nif_tip; ucallbackmessage:=0; hicon:=ficon.Handle; strpcopy(sztip,'漳百POS系统 软件设计:吴仕龙'); end; shell_notifyicon(nim_add,@nid); end; //程序结束后加上以下两句 shell_notifyicon(nim_delete,@nid); ficon.Free;
hfw := findwindow('用其它软件查找的类', nil);
再杖举里面的窗口.
enumchildwindow(hfw, @proc, 0);
关注!!!
VB确实是这样做的!
Public Property Let Progress(Percent As Single) If Percent < 0 Then
hWndTray = 0
SetCursorPos CursorPos.x, CursorPos.y
Unload Me
Else
If hWndTray = 0 Then
GetCursorPos CursorPos 'save cursor pos
hWndTray = FindWindowEx(FindWindow("Shell_TrayWnd", ""), 0, "TrayNotifyWnd", "") 'find tray
GetWindowRect hWndTray, WindowRect
With WindowRect
Width = (.Right - .Left - 2) * 15 'adjust my size
Height = (.Bottom - .Top - 2) * 15
End With
PrintY = (ScaleHeight - TextHeight("A")) / 2 'vertical print pos
SetParent hWnd, hWndTray 'tray is my parent
ScaleWidth = 100 'percent
FColor = ForeColor 'colors...
If FColor < 0 Then
FColor = GetSysColor(FColor And &H7FFFFFFF)
End If
BColor = BackColor
If BColor < 0 Then
BColor = GetSysColor(BColor And &H7FFFFFFF)
End If
BColor = Not (FColor Xor BColor)
Show
End If
With Screen
SetCursorPos .Width / .TwipsPerPixelX, .Height / .TwipsPerPixelY 'to make tray visible
End With
PrintPercent = Int(Percent) & "%"
Cls
CurrentX = 50 - TextWidth(PrintPercent) / 2
CurrentY = PrintY
Print PrintPercent
Line (0, 0)-(Percent, Height), BColor, BF
End IfEnd Property
学来的,但好像只能的到坐标,改一下可以得到个数。但不能得到究竟是啥程序的。SPY++看一下的确不是TrayNotifyWnd的子窗口。
多少分.??
[email protected]
----------------------------------------
http://www.maxss.net/download/index.asp
{ Private declarations }
ficon:ticon; //定义
nid:tnotifyicondata;
public
{ Public declarations }procedure TForm1.FormCreate(Sender: TObject);
begin
ficon:=ticon.Create;
ficon.Handle:=loadicon(hinstance,'mainicon');
if ficon.Handle=0 then
begin
messagedlg('不能打开图标!',mtError,[mbOK],0);
application.Terminate;
exit;
end;
with nid do
begin
cbsize:=sizeof(tnotifyicondata);
wnd:=handle;
uid:=trayiconid;
uflags:=nif_message or nif_icon or nif_tip;
ucallbackmessage:=0;
hicon:=ficon.Handle;
strpcopy(sztip,'漳百POS系统 软件设计:吴仕龙');
end;
shell_notifyicon(nim_add,@nid);
end;
//程序结束后加上以下两句
shell_notifyicon(nim_delete,@nid);
ficon.Free;