Autor Beitrag
MrFox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 208

WIN 2000 Professional, Ubuntu 5.10
D3 Prof, D7 Pers, D2005 Pers, Java (Eclipse)
BeitragVerfasst: So 28.01.07 19:45 
Hallo,

ist es möglich einen TThread sofort, radikal, völlig ungeachtet des "Terminated"-Werts von außen zu beenden?
Ich kann nämlich im Thread selber die Terminated-Abfrage nicht oft genug durchführen, da im Thread Bilder - große Bilder -
geladen werden. Beim Abbruch des Threads ist es völlig unerheblich ob die Bilder vollständig geladen sind.

mfg,
Julian

_________________
Das Leben auf der Erde mag zwar teuer sein, aber eine jährliche Rundreise um die Sonne ist gratis mit dabei.
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: So 28.01.07 19:56 
ich glaub schon, nähmlich wenn du ihn einfach freigibst:
ausblenden Delphi-Quelltext
1:
MyThread.Free;					
MrFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 208

WIN 2000 Professional, Ubuntu 5.10
D3 Prof, D7 Pers, D2005 Pers, Java (Eclipse)
BeitragVerfasst: So 28.01.07 19:58 
Mmmh, scheint zu funktionieren.
Danke für den Tipp.

_________________
Das Leben auf der Erde mag zwar teuer sein, aber eine jährliche Rundreise um die Sonne ist gratis mit dabei.
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: So 28.01.07 20:00 
Hast schon recht, ist keine besonders feine Möglichkeit, aber es müsste funktionieren...
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Sa 07.04.07 18:25 
So ist es noch besser, es gibt eine API-Funktion
ausblenden Delphi-Quelltext
1:
TerminateThread(hThread, dwExitCode: cardinal);					

Für hThread muss man Thread1.Handle einsetzen,
für dwExitCode muss man den Rückgabeparameter von GetExitCodeThread einsetzen.

ein Codebeispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function TerminateAThread(hThread: DWORD): Boolean;
var ec: DWORD;
begin
  Result := False;
  if not GetExitCodeThread(Handle,ec) then Exit;
  if not TerminateThread(Handle,ec) then Exit;
  Result := True;
end;


Wenn TerminateThread <> 0 (= True), dann Erfolgreich!


Zuletzt bearbeitet von Jakob Schöttl am Mo 09.04.07 09:09, insgesamt 1-mal bearbeitet
dsJena
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 25

Windows Vista

BeitragVerfasst: Sa 07.04.07 20:18 
Weiß eigentlich jemand, wie man den Taskmanager in Vista auch ohne das umständliche ALT-STRG-ENTF und dann auf "Task-Manager"-klicken öffnen kann, also nur mit einer Tastenkombination?
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Sa 07.04.07 20:22 
Du kannst entweder auf die einfache Benutzeransicht wechseln (den Wilkommensbildschirm musst du glaub aktivieren), oder du erstellst dir eine Verknüpfung zu "taskmgr.exe" und setzt eine beliebige Tastenkombination. So geht es unter XP, bei Vista kenn ich mich nicht aus.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 07.04.07 20:29 
user profile icondsJena hat folgendes geschrieben:
Weiß eigentlich jemand, wie man den Taskmanager in Vista auch ohne das umständliche ALT-STRG-ENTF und dann auf "Task-Manager"-klicken öffnen kann, also nur mit einer Tastenkombination?


neue Frage, neues Thread! Sonst wirds unübersichtlich und die Suchfunktion wird nutzlos. ;)
grüße