Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Problem mit OpenProcess (https://www.delphipraxis.net/54245-problem-mit-openprocess.html)

T3rm1n4T0r 30. Sep 2005 13:46


Problem mit OpenProcess
 
Hi!
Delphi-Quellcode:
function OpenMinesweeper : boolean;
var PID : cardinal;
    Window : cardinal;
begin
  Window := FindWindow(nil,'MineSweeper');
  GetWindowThreadProcessId(Window,@PID);
  myHandle := OpenProcess(PROCESS_VM_READ,false,PID);
  if (myHandle <> 0) then result := true else result := false;
end;
Warum funcktioniert dieser Code nicht?

myHandle isn cardinal.
Window hat einen Wert <> 0;
PID hat einen Wert <> 0;
myHandle ist 0!!
GetlastError sagt Invalid Parameter.

Ich versteh das nicht.

brechi 30. Sep 2005 13:54

Re: Problem mit OpenProcess
 
Delphi-Quellcode:
function OpenMinesweeper : cardinal;
var PID : cardinal;
    Window : cardinal;
begin
  Window := FindWindow(nil,'MineSweeper');
  GetWindowThreadProcessId(Window,PID);
  result := OpenProcess(PROCESS_VM_READ,false,PID);
end;
geht ohne probleme

T3rm1n4T0r 30. Sep 2005 13:55

Re: Problem mit OpenProcess
 
Nein, bei mir nicht.

Edit: Hat sich erledigt. Close pls

Luckie 30. Sep 2005 16:30

Re: Problem mit OpenProcess
 
Zitat:

Zitat von T3rm1n4T0r
Nein, bei mir nicht.

Edit: Hat sich erledigt. Close pls

Verrätst du uns auch warum?

T3rm1n4T0r 30. Sep 2005 19:10

Re: Problem mit OpenProcess
 
Hab die Funktion aus der dll direkt importiert und ein stdcall; vergessen :/

Christian Seehase 30. Sep 2005 20:16

Re: Problem mit OpenProcess
 
Moin T3rm1n4T0r,

kleiner (Verbesserungs?)-Vorschlag:

Delphi-Quellcode:
result := (myHandle <> 0);


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:18 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz