AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Probleme mit WinAmp Hook

Ein Thema von LoCrux · begonnen am 15. Mai 2008 · letzter Beitrag vom 17. Mai 2008
Antwort Antwort
Benutzerbild von LoCrux
LoCrux

Registriert seit: 5. Mär 2007
Ort: Gwang-Yang-City
48 Beiträge
 
Delphi 2009 Enterprise
 
#1

Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 07:42
Hi @All,

vielleicht kann mir einer helfen. Ich will einen Message-Hook auf WinAmp.
Funzt aber nicht. Bekomme als Global_HookHandle immer nur 0, Zero, Null, NADA ...
Vielleicht weiss einer Rat.

Delphi-Quellcode:
.
.
var
  Global_HookHandle : HWND = 0;
  Global_WinAmpHandle : HWND = 0;
  Global_HookInstalled : Boolean = false;

function AmpHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  if (wParam = IPC_SETVOLUME)
  then asm
    NOP; // Just for debugging purpose
  end;
  Result := CallNextHookEx(Global_HookHandle, nCode, wParam, lParam);
end;

function GlobalUnInstallHook:Boolean; stdcall;
begin
  //Hook aus der Hookchain entfernen
  Global_HookInstalled := UnhookWindowsHookEx(Global_HookHandle);
  if not(Global_HookInstalled)
  then begin
    Global_HookHandle := 0;
    Global_WinAmpHandle := 0;
  end;
  Result := Global_HookInstalled;
end;

function GlobalInstallHook:Boolean; stdcall;
var
  TID : DWORD; // Thread ID
  PID : LPDWORD; // Process ID -- Just for Testing with Sysinternals ProcessExplorer
begin
  Result := no;
  if (Global_HookHandle=0)
  then begin
    {$WARNINGS OFF}
    new(PID);
    TID := GetWindowThreadProcessId(Global_WinAmpHandle,PID);
    Global_HookHandle := SetWindowsHookEx(WH_CALLWNDPROCRET,@AmpHookProc, 0, TID);
    Global_HookInstalled := (Global_HookHandle<>0);
    Result := Global_HookInstalled;
    dispose(PID);
    {$WARNINGS ON}
  end;
end;

.
.

procedure TForm2.FindWinamp;
begin
  Global_WinAmpHandle := FindWindow('Winamp v1.x', nil);
  WinampRunning := (Global_WinAmpHandle<>0);
end;
Bevor die Frage kommt warum... Ich will ein Frontend fuer WinAmp selber schreiben.. Warum CarPC Bedienoberflaeche mit Touchscreen..
Warum.. Alles was es gibt gefaellt mir nicht oder ist zu teuer.

(P.S. vielleicht hat ja jemand Lust mit einzusteigen..)

EIDTS: Falsche Fehler
Angehängte Dateien
Dateityp: 7z winamp_893.7z (182,0 KB, 4x aufgerufen)
“C++ is an insult to the human brain.” [Niklaus Wirth]

2B OR NOT 2B (.. THAT IS FF)
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#2

Re: Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 08:36
Weiss nicht obs was bringt aber versuchs doch mal mit Watch..
Mit sicherheit sind einige Hilfreiche infos darin enthalten.

gruss Emil
  Mit Zitat antworten Zitat
Benutzerbild von LoCrux
LoCrux

Registriert seit: 5. Mär 2007
Ort: Gwang-Yang-City
48 Beiträge
 
Delphi 2009 Enterprise
 
#3

Re: Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 08:47
AEHHHH... WATCH..????
“C++ is an insult to the human brain.” [Niklaus Wirth]

2B OR NOT 2B (.. THAT IS FF)
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#4

Re: Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 09:01
Zitat von LoCrux:
AEHHHH... WATCH..????
hmmmm http://www.bome.com/delphi/

gruss Emil
  Mit Zitat antworten Zitat
Benutzerbild von LoCrux
LoCrux

Registriert seit: 5. Mär 2007
Ort: Gwang-Yang-City
48 Beiträge
 
Delphi 2009 Enterprise
 
#5

Re: Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 10:30
AHHHHHH!!!!
“C++ is an insult to the human brain.” [Niklaus Wirth]

2B OR NOT 2B (.. THAT IS FF)
  Mit Zitat antworten Zitat
Wotan89

Registriert seit: 20. Nov 2007
77 Beiträge
 
Delphi 2005 Personal
 
#6

Re: Probleme mit WinAmp Hook

  Alt 15. Mai 2008, 11:26
Wenn ich mich nicht täusche musst du bei SetWindowsHookEx beim 3.Parameter HInstance (wenn sich dein Quelltext in einer DLL befindet) übergeben, sonst weiß er nicht in welchem Modul sich deine Funktion befindet. Ich kann mich aber auch irren.
  Mit Zitat antworten Zitat
Benutzerbild von LoCrux
LoCrux

Registriert seit: 5. Mär 2007
Ort: Gwang-Yang-City
48 Beiträge
 
Delphi 2009 Enterprise
 
#7

Re: Probleme mit WinAmp Hook

  Alt 16. Mai 2008, 00:41
@Wotan

Zitat von Wotan:
Wenn ich mich nicht täusche musst du bei SetWindowsHookEx beim 3.Parameter HInstance (wenn sich dein Quelltext in einer DLL befindet) übergeben, sonst weiß er nicht in welchem Modul sich deine Funktion befindet. Ich kann mich aber auch irren.
Du irrst dich nicht , meine Hook-Proc liegt alledings im aufrufenden Process.

Zitat von MSDN:
Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
Also daran liegts nicht...

EDIT:

P.S.:
Ich werde auf die Bass.dll wechseln. Wuerde aber trotzdem gerne wissen, warum der Hook nicht hakt
“C++ is an insult to the human brain.” [Niklaus Wirth]

2B OR NOT 2B (.. THAT IS FF)
  Mit Zitat antworten Zitat
Wotan89

Registriert seit: 20. Nov 2007
77 Beiträge
 
Delphi 2005 Personal
 
#8

Re: Probleme mit WinAmp Hook

  Alt 17. Mai 2008, 11:47
Ich hab die Variante noch nicht probiert, dass sie im aufrufenden Prozess liegt, daher denke ich, dass die Hook-Proc in einer DLL liegen muss, denn sonst können andere Prozesse nicht auf diese Funktion zugreifen... Zumindest fände ich es unlogisch, wenn dies nicht der Fall wäre.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz