Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 08.01.07 16:04 
Also, ich habe folgenden Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
const res_max = 255;
var wnd:hwnd;
    i:integer;
    Info:TLVHitTestInfo;
    res:array[0..res_max+1] of char;
begin
  // Desktop Listview finden
  wnd :=  FindWindow('Progman', 'Program Manager');
  wnd :=  FindWindowEx(wnd, 0, 'SHELLDLL_DefView', nil);
  wnd :=  FindWindowEx(wnd, 0, 'SysListView32', nil);

  if wnd <> 0 then
  begin
    ZeroMemory(@info,sizeof(info));
    Info.pt:= Mouse.CursorPos;
    // Ist da was unter der Maus?
    i:= Listview_HitTest(wnd,Info);
    if i<>-1 then begin
      // Text holen
      ListView_GetItemText(wnd,i,0,Res,res_max);
      Caption:= res;
    end;
  end;


Hier möchte ich die Caption des Desktop-Icons unter der Maus feststellen. (Geht das so überhaupt? Oder muss ich da sowas kompliziertes machen wie Luckie im DIPS?) Das Problem ist: I wird entweder -1 oder aber der Aufruf von Listview_Hittest löst einen Fehler in Explorer.exe aus, so dass diese beendet werden muss (und sich dann neu startet).
Was ist da bitte los?

Danke schonmal
Martok

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
DBR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Mo 22.01.07 18:05 
Der Fehler tritt auf, wenn du nicht auf den Desktop klickst, denn dann stimmt das ermittelte Handle nicht mit dem des Controls unter der Maus überein. Klickst du aber auf den Desktop, dann merkt das dein Programm nicht. Du musst also einen Maushook installieren.
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 22.01.07 18:56 
Ähm, ja.

Hätte nicht gedacht, dass sich hier noch was tut^^

Inzwischen hab ich schon nen Hook, und es funktioniert auch alles (mal davon abgesehen, dass man mit geladenem Hook nicht debuggen kann :roll:)

Trotzdem versteh ich nicht, wieso Explorer.exe da immer abgestürzt war. Aber egal, tritt jetzt eh nicht mehr auf.

-=(geschlossen)=-

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."