- EMULE çalışıyor mu sorgusunu nerede yapıyorsun, göremiyorum ?!
- Neyse ben sana anahtar teslimi kod hazırladım. Bana da lazımdı bir ara ama elim değmemişti. Bahane ile kendi downloadlarımı da gece otomatik başlamaya ayarlamış oluyorum...
- Bu arada üçüncü parti bir TrayIcon bileşeni kullanmak yerine her zaman olduğu gibi kendi yağımızda kavrulmayı öğrenmeliyiz diyerek, bileşen yerine kod ile TrayIcon özelliği ekledim.
Download Linki (
Kaynak Kodları ve Çalışan EXE içinde)
Ref :
http://rapidshare.com/files/19153670/Za ... v.zip.html
Kod: Tümünü seç
private
TrayIcon: TNotifyIconData;
procedure TrayMessage(var Msg: TMessage); message WM_ICONTRAY;
Procedure FormuGizle(Sender: TObject);
Procedure FormuGoster;
Procedure MenuyuGoster;
{ Private declarations }
// Anahtar Fonksiyon bu,
Emule çalışıyorsa işlem yapmasın diye..
Kod: Tümünü seç
Function EmuleCalisiyor : Boolean;
Var
hEmule : THandle;
Title,
ClassName : array[0..255] of char;
begin
Result := False;
hEmule := Application.Handle;
while ( hEmule > 0 ) AND (NOT Result) do
begin
GetWindowText(hEmule, Title ,255);
GetClassName (hEmule, ClassName,255);
If (ClassName = '#32770') AND ( Pos('EMULE', UpperCase(Title) ) > 0 )
then Result := True;
hEmule := GetnextWindow(hEmule, GW_HWNDNEXT);
end; // While
end;
Kod: Tümünü seç
procedure TForm1.FormuGizle(Sender: TObject);
begin
with TrayIcon do
begin
cbSize := SizeOf(TrayIcon);
Wnd := Handle;
uID := 0;
uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
uCallbackMessage := WM_ICONTRAY;
hIcon := Application.Icon.Handle;
StrPCopy(szTip, Application.Title);
end;
Shell_NotifyIcon(NIM_ADD, @TrayIcon); // System Tray'e yeni bir Icon ekle
Form1.Hide; // Formu gizle
end;
Kod: Tümünü seç
procedure TForm1.FormuGoster;
Begin // Uses'a ShellApi
Form1.Show;
Application.Restore;
Form1.SetFocus;
Application.BringToFront;
Shell_NotifyIcon(NIM_DELETE, @TrayIcon);
end;
Kod: Tümünü seç
procedure TForm1.MenuyuGoster;
Var
FareninKonumu : TPoint;
Begin
GetCursorPos(FareninKonumu); // Mouse'un pozisyonunu öğren
PopUpMenu1.Popup(FareninKonumu.X,FareninKonumu.Y); // PopUp menüyü o pozisyona aç
PostMessage(Self.Handle,WM_NULL,0,0); // Systeme Herhangibir Mesaj Gönderme
end;
Kod: Tümünü seç
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label2.Caption:=TimeToStr(now);
if Trim(Label2.Caption) = '01:00:00' then
begin
If NOT EmuleCalisiyor() then begin
WinExec('D:\katırr\emule.exe', SW_SHOWNORMAL);
end;
end;
end;
Kod: Tümünü seç
procedure TForm1.TrayMessage(var Msg: TMessage);
begin
case Msg.lParam of
WM_LBUTTONDOWN:
Abort;
WM_LBUTTONDBLCLK:
begin
FormuGoster();
end;
WM_RBUTTONUP:
begin
MenuyuGoster();
end;
end;
end;
Kod: Tümünü seç
procedure TForm1.FormuGster1Click(Sender: TObject);
begin
FormuGoster();
end;
Kod: Tümünü seç
procedure TForm1.Button2Click(Sender: TObject);
begin
FormuGizle(Self);
end;
Afiyet olsun...