I am trying to call this using the NativeCall dll in Lotus Notes. However, this code does not run and throws an
UnsupportedOperationException on NativeCall.init()
Therefore, I assumed the dll is not propery placed. I put Nativecall.dll in the C:\Notes folder. Do I need to put it elsewhere? Or is that correct, and the code itself is faulty. All I call is "WindowUtils.isRemote()" print line. Thank you.
import com.eaio.*;
import com.eaio.nativecall.IntCall;
import com.eaio.nativecall.NativeCall;
import java.io.*;
class WindowsUtils {
public static final int SM_REMOTESESSION = 4096; // remote session
//Session.getPlatform() = Windows/16 or /32
private WindowsUtils() {}
public static boolean isRemote() throws SecurityException, UnsatisfiedLinkError,
UnsupportedOperationException, IOException
{
NativeCall.init();
ntCall ic = null;
try {
ic = new IntCall("user32", "GetSystemMetrics");
int rc = ic.executeCall(new Integer(SM_REMOTESESSION));
System.out.println(rc);
return true;
//return (rc gt; 0);
}
finally {
if (ic != null) ic.destroy();
}
}
public static void main(String ... args) throws Exception {
System.out.println(WindowsUtils.isRemote());
}
}
Based on the info provided in the comments, the issue is that NativeCall.dll cannot be loaded because it is compiled for Win64 but the Notes client code is Win32. Even when running under SysWOW64 emulation, Win32 code cannot load a 64 bit DLL.