Autor Beitrag
Sal-9000
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.01.10 04:06 
Hi

ich hab da mal wieder eine Frage:
Wie kann ich den Windows-Fehler bzw Nachrichtendialog abfangen?
Zur Erklärung .... ich versuche eine Datei zu löschen, auf die gerade zugriff besteht ... ergebniss: Windows ist "so nett" mich mit einem DING und einer Fehlermeldung darauf aufmerksam zu machen.

Wie kann ich diese Meldung nun am effektifsten abfangen, noch bevor auch nur ein flackern zu sehen ist bzw ein ton zu hören ist?
soweit ich das immo verstanden habe, muss ich dafür einen ShellHook einsetzen ... stimmt das? Wenn ja, wie kann ich damit den Dialog abfangen, bevor er wirklich erzeugt wird?

Ach ja ... nutze XP Pro, falls das entscheident sein sollte!

Danke schonmal
Sal-9000
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 10.01.10 04:32 
Grobe Frage: Wozu willst das machen? Sowas wie nen Auto-Unlocker?

Theoretisch ja; ließe sich aber auch mit nem API-Hook realisieren.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Sal-9000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.01.10 04:35 
Weil ich auf den einen oder anderen Fehler gerne reagieren würde, ohne selbst am pc zu sein :)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 10.01.10 04:44 
Dann wäre ein API-Hook IMHO die bessere Variante.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Sal-9000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.01.10 04:47 
ok, und das mach ich wie ? Ich werd nu erstmal nach API-Hook schauen .... wie läuft das denn dann? Übers handel direkt geht ja nicht, da wurde die meldung ja bereits kreiert...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 10.01.10 04:55 
Siehe uallCollection. Da gab's auch mal ne Demo, was man da so alles tun kann.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Astat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 75
Erhaltene Danke: 1

Windows 2000
D6, D7, D2007, Lazarus
BeitragVerfasst: So 10.01.10 06:44 
user profile iconSal-9000 hat folgendes geschrieben Zum zitierten Posting springen:
ok, und das mach ich wie ? Ich werd nu erstmal nach API-Hook schauen .... wie läuft das denn dann? Übers handel direkt geht ja nicht, da wurde die meldung ja bereits kreiert...


Hallo Sal-9000, bevor Du zu Hooken anfängst, kannst Du dass mal versuchen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function IsFileInUse(const FileName: string): Boolean;
var
  hFileRes: HFILE;
begin
  Result := False;
  if not FileExists(FileName) then Exit;

  hFileRes := CreateFile(PChar(FileName), GENERIC_READ or GENERIC_WRITE, 0nil,
    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

  Result := (hFileRes = INVALID_HANDLE_VALUE);

  if not Result then
    CloseHandle(hFileRes);
end;


lg. Astat
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.01.10 17:04 
Und warum willst du den Benutzer im Unklaren darüber lassen, warum sich die Datei nicht löschen lässt?
Sal-9000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.01.10 22:08 
Hi

aaaaaaaalso ... erstens: Der Benutzer ... bin ich :D
zweitens würde ich gerne Fehler abfangen und loggen können mit dem zusatz, die entsprechende meldung so abzufangen, das sie nicht auftaucht.
Es muss doch ieinen Weg geben, das, was Windows macht, wenn ein Fehler auftaucht, abzufangen und zu analysieren .....