1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, ShellApi, OleCtrls, SHDocVw, ActiveX, ExtCtrls, MMSystem, ComCtrls;
type TForm1 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; Timer1: TTimer; GroupBox1: TGroupBox; ComboBox1: TComboBox; Button2: TButton; Label1: TLabel; Label2: TLabel; procedure Button2Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure WebBrowser1DownloadComplete(Sender: TObject); procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1;
implementation
{$R *.dfm} {$R userstatus} procedure TForm1.Button1Click(Sender: TObject); begin if ComboBox1.ItemIndex =-1 then ShowMessage ('please chose or enter an UIN!') else begin Label1.Caption := 'scanning...'; WebBrowser1.Navigate('http://web.icq.com/whitepages/online?icq='+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+'&img=x'); end; end;
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); begin Timer1.Enabled := true; end;
procedure TForm1.Timer1Timer(Sender: TObject); var hFind, hRes: THandle; Song: PChar; i : INTEGER; begin if pos('online1',WebBrowser1.LocationURL)>0 then begin hFind:=FindResource(HInstance, 'userstatus', 'WAVE'); if hFind<>0 then hRes:=LoadResource(HInstance, hFind); if hRes<>0 then begin Song:=LockResource(hRes); if Assigned(Song) then SndPlaySound(Song, snd_ASync or snd_Memory); UnlockResource(hRes); end; FreeResource(hFind); Label2.Caption := 'Userstatus: Online'; end; Button1.Click;
if pos('online0',WebBrowser1.LocationURL)>0 then Label2.Caption := 'Userstatus: Offline'; if WebBrowser1.LocationURL = 'http://web.icq.com/whitepages/online?icq='+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+'&img=x' then begin Label2.Caption := 'Userstatus:'; Label1.Caption := 'Connection failed'; ShowMessage ('Connection to Internet failed!');; end; end;
procedure TForm1.Button2Click(Sender: TObject); begin Label1.Caption := 'OFF'; Label2.Caption := 'Userstatus:'; Timer1.Enabled := false; end;
end. |