Little Problem with IProcess.ExecuteFunction

delphi package - easy access to kernel objects etc.
Post Reply
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

Little Problem with IProcess.ExecuteFunction

Post by neji »

Hi Matthias,

I want to run a function in the context of a foreign process. So I wanted to use ExecuteFunction.

Your example works just fine, but how can I pass an Integer/cardinal Value as the Parameter?

I tried to cast the param in the Remote function

Code: Select all

procedure RemoteFunction(var params);
var
  dwStyle : Integer;
begin
  dwStyle := GetWindowLong(Integer(params),GWL_STYLE);
  [...]
end;
But this doesn't work. If I put the Handle directly in the Function it works fine. How do I have to cast the param to work with GetWindowLong, SendMessage and so on?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

"params" is a memory block. You should typecast it. E.g.:

Code: Select all

procedure RemoteFunction(var params);
type
  TParamsRec = record
    handle : dword;
  end;
var
  dwStyle : Integer;
begin
  dwStyle := GetWindowLong(TParamsRec(params).handle, GWL_STYLE);
  [...]
end; 
Post Reply