Autor Beitrag
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Di 02.09.03 18:28 
Hallöle
Ich habe echt keine Idee wie das gehen soll, geht dass nur wenn man einen Thread aus seinem eigenen Progr. kreirt? Ich möchte aber die Priorität eines anderen Programmes verändern :-(
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.09.03 00:58 
Hol dir ein Handle auf den Prozess und dann setzt mit SetPriorityClass die Priorität.
digi_c Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 22.10.03 19:18 
Also ich hab einiges versucht und auch wirklich hier im Board gesucht und gegoogelt wie ein Verrückter aber ich finde nix :cry: könnte mir da jemand mit einem Codeschnipsel weiterhelfen denn leider sind meine Win API Kenntnisse sehr beschränkt :oops:
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 23.10.03 11:34 
Was hat denn nicht geklappt? Das herausfinden des Handles oder das setzen der Priorität?

Gruß
Tino
digi_c Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Fr 24.10.03 18:24 
Das setzen der Prioritäten, den Handle des Prozesses hab ich
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 24.10.03 19:20 
Ist es auch das richtige? Und zeig mal etwas Code.
digi_c Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Sa 25.10.03 21:49 
Das stimmt schon, ist ne routine die ich auch für andere Dinge benutz, aber ich hab 0plan wie ich mit dem Kommando die Priorität verändern soll
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 26.10.03 00:33 
Dann zeig doch mal etwas Code! Inklusive, wie du an das Handle von den Prozess kommst.
digi_c Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Di 28.10.03 19:17 
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:
function boost(Programname:string):boolean;
Var
  Proc: PROCESSENTRY32;
  HSnap: HWND;
  Looper: BOOL;

Begin
  isprogramrun:=false;
  Proc.dwSize:= SizeOf(Proc);
  HSnap:= CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
  Looper:= Process32First(HSnap, Proc);
  While Integer(Looper)<> 0 Do
    Begin
      If ExtractFileName(Proc.szExeFile)= Programname then
        Begin
          proc.th32ParentProcessID <- Da ist der Handle
          Break;
        End
      Else
        Looper:= Process32Next(HSnap, Proc);
    End;
  CloseHandle(HSnap);
End;

Der Code ist natürlich nicht von mir, denn ich verstehe ja nu wirklich fast nichts von Systemnaher Programmierung. Jetzt wo du so nachhakst, ist das überhaupt das Handle :-?

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 28.10.03 22:01 
Überleg mal: th32ParentProcessID...

Das ist die ProzessID, das Handle bekommst du mit OpenProcess. Wie war das jetzt mit dem Handle, das ganz sicher stimmt? :roll:
digi_c Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Do 30.10.03 19:18 
ich Nub, aber ich hab ja gesacht das ich wenig Ahnung hab :wink: Werd mir bei Gelegenheit das ein oder andere Tut zur systemnahen Programmierung antun :D