All structure parameters are passed by reference unless explicitly
passed by value by using the ByValue interface.
On Oct 8, 2008, at 11:31 AM, D.Ulzii-Orshikh wrote:
Dear Timothy Wall,
I am writing simple Java application that detects foreground window.
And I need to get EXE filename of current window. But I can not
pass by reference my PROCESSENTRY32 structure to function
Process32First function. Please help me friend ?
Here is my code :
public class PROCESSENTRY32 extends Structure {
public static class ByReference extends
PROCESSENTRY32 implements Structure.ByReference {};
public int dwSize;
public int cntUsage;
public int th32ProcessID;
public Pointer th32DefaultHeapID; //ULONG_PTR
public int th32ModuleID;
public int cntThreads;
public int th32ParentProcessID;
public NativeLong pcPriClassBase;
public int dwFlags;
public char[] szExeFile;
public PROCESSENTRY32() {
szExeFile = new char[250];
}
}
…
boolean Process32First(HANDLE hSnapshot, PROCESSENTRY32 lppe);
…
Kernel32.PROCESSENTRY32.ByReference pe;
pe = new Kernel32.PROCESSENTRY32.ByReference();
…
kernel32.Process32First( hProcessSnap, pe32 )
Thank you ,
Please help me friend.
Olzii