Control(AOwner).Handle; New(Fpda); With FPda^ do begin uCallbackMessage:=WM_MY_Notify; cbsize:=SizeOf(FPda^); uID:=200; wnd:=Handle; uFlags:=NIF_ICON+NIF_Tip+NIF_MESSAGE; end;
if (csDesigning in ComponentState) then begin if GetUserDefaultLCID = MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) then Application.MessageBox( ''''Write by 南昌大学 付昱纲''''#13#13''''E-mail:fyg@163.net''''#13#13'''' 1998.8.17'''', ''''TNotifyIcon 控件 V 1.01'''',MB_OK+ MB_ICONINFORMATION) else Application.MessageBox( ''''Write by NanChang University FuYuGang''''#13#13''''E-mail:fyg@163.net''''#13#13'''' 1998.8.17'''', ''''TNotifyIcon Component V 1.01'''',MB_OK+ MB_ICONINFORMATION); end; except ShowMessage(''''TNotifyIcon Create error''''); end; end;
procedure TNotifyIcon.SetIcon(Icon:TICON); begin FIcon.Assign(Icon); end;
procedure TNotifyIcon.ShowIcon; begin try if FIcon.Handle=0 then begin Exit; end; if FIcon.Handle<>FPda^.hIcon then HideIcon; if FIconVisible=false then begin FPda^.hIcon:=FIcon.handle; FIconVisible:=true; Shell_NotifyIcon(NiM_ADD,FPda); end; except ShowMessage(''''TNotifyIcon Show Error ''''); end; end;
procedure TNotifyIcon.HideIcon; begin try if FIconVisible then begin FIconVisible:=false; Shell_NotifyIcon(NiM_DELETE,FPda); end; except ShowMessage(''''TNotifyIcon Hide Error''''); end; end;
procedure TNotifyIcon.SetTitle(NewTitle:string); begin FTitle:=NewTitle; StrCopy(FPda^.szTip,PChar(FTitle)); if FIconVisible then begin HideIcon; ShowIcon; end; end;