This app draws text on the top left corner of the screen. It has UTC Time, Uptime, last IRC Channel message in mIRC, Error Of The Day, Memory Load, IP Addresses and Phase Of The Moon. It’s lightweight and open source.
program delpfo; {$RESOURCE DelpFo32.RES} uses SysUtils, Windows, graphics, Classes, mIRCc in '..\delphi\TmIRCControl\mIRCc.pas'; const AppName='delpFo'; DB_HOLIDAY_DATE='%u/%u'; DB_HOLIDAY_YEAR=DB_HOLIDAY_DATE+'.year'; DELPFO_ATOM_CLOSE='DELPFO_CLOSE'; DELPFO_ATOM_MAIN='DELPFO_APP'; SWITCH_MOON='/MOON'; SWITCH_HOLIDAY='/HOLIDAY'; SWITCH_CLOSE='/CLOSE'; SWITCH_UTC='/UTC'; SWITCH_UPTIME='/UPTIME'; SWITCH_MEM='/MEM'; SWITCH_BOLD='/BOLD'; SWITCH_IPV4='/IPV4'; SWITCH_RIGHT='/RIGHT'; SWITCH_POSX='/POSX'; SWITCH_ERROR='/ERROR'; SWITCH_MIRC='/MIRC'; SWITCH_POSY='/POSY'; SWITCH_FC='/FC'; SWITCH_FONT='/FONT'; SWITCH_FSIZE='/FSIZE'; type TMoonInfo=record MoonType:byte; end; var utc,moontime:systemtime; monitor:tcanvas; args,IPs:tstringlist; i:integer; uptime:tdatetime; moon:tmooninfo; Text:string; mem:memorystatus; hk,netadaptors:hkey; enabledhcp,netcount,rs:dword; mIRC:TMIRCControl; buff,kname:array[0..max_path]of char; r:trect; label loop; procedure close; var error:dword; begin error:=0; if globaldeleteatom(globalfindatom(DELPFO_ATOM_CLOSE))>0then error:=error or 1; if Globaldeleteatom(globalfindatom(delpfo_atom_main))>0then error:=error or 2; if releasedc(getdesktopwindow,monitor.handle)=0then error:=error or 4; mirc.Destroy; exitprocess(error); end; function PhaseOfMoon(var systime:systemtime):TMoonInfo; var b,c,e,jd:double; begin systime.wMonth:=systime.wMonth-1; if systime.wMonth<3then begin systime.wYear:=systime.wYear-1;systime.wMonth:= systime.wMonth+12;end;systime.wMonth:=systime.wMonth+1;c:=365.25*systime.wYear; e:=30.6*systime.wMonth;jd:=c+e+systime.wDay-694039.09;jd:=jd/29.5305882;b:=trunc( jd);jd:=jd-b;b:=round(jd*8); if b >= 8 then b:=0; result.MoonType:=trunc(b); end; function ErrorOfTheDay:integer; label loop; begin randseed:=trunc(date); loop:result:=random(16000); if length(SysErrorMessage(result))=0then goto loop; end; function FormatHoliday(fmt:string;systime:systemtime):string; begin result:=format(fmt,[systime.wMonth,systime.wDay]); end; function getHoliday:string; var ltime:systemtime; res:tresourcestream; holidays:tstringlist; begin getlocaltime(ltime); holidays:=tstringlist.Create; res:=tresourcestream.Create(hinstance,'HOLIDAYS','DATABASE'); holidays.LoadFromStream(res); result:=format(holidays.values[formatholiday(db_holiday_date,ltime)],[ltime.wyear- strtointdef(holidays.values[formatholiday(db_holiday_year,ltime)],0)]); holidays.Free; res.Free; end; begin args:=tstringlist.Create; for i:=1to paramcount do args.Add(paramstr(i)); if args.Count=0 then begin messagebox(0,pchar( 'Usage:'+extractfilename(paramstr(0))+' <parameters>'#13#10+ '/UPTIME Shows uptime'#13#10+ '/MEM Global memory status'#13#10+ '/UTC Universal Time Coordinates'#13#10+ '/IP4 Shows IPv4 Addresses'#13#10+ '/MOON Shows phase of moon'#13#10+ '/POSX=x /POSY=y Position on the screen where to draw text'#13#10+ '/RIGHT Draw onto top right'#13#10+ '/FONT=NAME Specifies font-name.'#13#10+ '/FC=COLOR Font-color in hexadecimal'#13#10+ '/FSIZE=SIZE Font size'#13#10+ '/ERROR Error of the day'#13#10+ '/MIRC=Channel Shows the last chat channel message in mIRC'#13#10+ '/HOLIDAY Shows the current holiday, if theres is one.'#13#10+ '/BOLD Use Bold Font' ),'DelpFo Help',0); exitprocess(0); end; if args.IndexOf(SWITCH_CLOSE)>-1then begin if globalfindatom(delpfo_atom_main)>0then begin globaladdatom(delpfo_atom_close);globaldeleteatom(Globalfindatom(delpfo_atom_main)); end else begin Messagebox(0,PChar(loadstr(106)), appname,mb_iconinformation);exitprocess(dword(-1)); end; exitprocess(0); end; if globalfindatom(DELPFO_ATOM_MAIN)>0then begin messagebox(0,pchar(loadstr(104)),appname,mb_iconwarning);exitprocess( error_already_exists); end; globaladdatom(delpfo_atom_main); getclientrect(getdesktopwindow,r); r.TopLeft.x:=StrToIntDef(args.values[switch_posx],0); r.TopLeft.y:=strtointdef(args.values[Switch_posy],0); monitor:=tcanvas.Create; monitor.Handle:=GetWindowDC(getdesktopwindow); if args.IndexOfName(switch_font)>-1then monitor.Font.Name:=args.Values[SWITCH_FONT]; monitor.Font.Color:=StrToIntDef('$'+args.values[SWITCH_FC],0); monitor.Font.Size:=strtointdef(args.values[switch_fsize],monitor.Font.Size); if args.IndexOf(switch_bold)>-1then monitor.Font.Style:=[fsBold]; mirc:=tmirccontrol.create(nil); loop: text:=''; getsystemtime(utc);Getlocaltime(moontime); uptime:=encodetime(0,0,0,1)*gettickcount; mem.dwLength:=sizeof(mem); globalmemorystatus(mem); if args.IndexOf(SWITCH_UPTIME)>-1then Text:=format(loadstr(100),[trunc( uptime),formatdatetime(loadstr(101),uptime)]); if args.IndexOf(SWITCH_UTC)>-1 then text:=text+'UTC:'+formatdatetime(loadstr(105), systemtimetodatetime(utc))+#32; if args.IndexOf(SWITCH_MEM)>-1then text:=text+format(loadstr(102),[ mem.dwMemoryLoad]); regopenkey(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces',netadaptors); regqueryinfokey(netadaptors,nil,nil,nil,@netcount,nil,nil,nil,nil,nil,nil,nil); if args.IndexOf(SWITCH_IPV4)>-1then begin ips:=tstringlist.Create; for i:=0to netcount-1do begin regenumkey(netadaptors,i,kname,max_path); regopenkey(netadaptors,kname,hk); rs:=4; regqueryvalueex(hk,'EnableDhcp',nil,nil,@enabledhcp,@rs); rs:=max_path; if enableDhcp=1then regqueryvalueex(hk,'DhcpIPAdress',nil,nil,@buff,@rs)else regqueryvalueex(hk,'IPAddress',nil,nil,@buff,@rs); ips.Add(buff); regclosekey(hk); end; text:=text+'IPs:'+ips.CommaText; ips.Free; end; text:=text+#32; regclosekey(netadaptors); if args.IndexOf(SWITCH_MOON)>-1then begin moon:=PhaseOfMoon(moontime); text:=text+format(loadstr(103),[loadstr(200+moon.MoonType)]); end; if args.IndexOfName(switch_mirc)>-1then begin mirc.active:=false; mirc.mIRCHandle:=findwindow('mIRC',nil); mirc.Active:=true; text:=text+mirc.GetLastLine(args.values[switch_mirc])+#32; end; if args.IndexOf(switch_holiday)>-1then text:=text+GetHoliday; if args.IndexOf(switch_error)>-1then text:=text+'EOTD:'+ syserrormessage(erroroftheday)+#32; if args.IndexOf(SWITCH_RIGHT)>-1then r.Left:=r.Right-(5+monitor.TextWidth(text)); monitor.TextOut(r.TopLeft.x,r.TopLeft.y,text); if globalfindatom(delpfo_atom_close)>0 then close; sleep(1000); goto loop; end.