JNA with Ignition 8.x

Hello everybody.

If I well understood, until Ignition 7.x, the java libraries (JNA) was native from SUN.
But with Ignition 8.x the java lib are deployed by Inductive Automation with a custom package.

This shouldn’t a big issue but since now our previous scripts do not run anymore.
For a real example the following script now crashes at the first row:

**from com.sun.jna.platform.win32 import** *
**from com.sun.jna.platform.win32.WinDef import** *                

def SendMessage(wndCaption, messageCode, wParam, lParam):                   
                        
            wPARAM = WPARAM(wParam)
            lPARAM = LPARAM(lParam)
            
            hWnd = User32.INSTANCE.**FindWindow**(None, wndCaption)
            User32.INSTANCE.**PostMessage**(hWnd, messageCode, wPARAM, lPARAM)
            if (None != hWnd):
                        User32.INSTANCE.**SetForegroundWindow**(hWnd)
            
def IsRunning(wndCaption):
            
            hWnd = User32.INSTANCE.**FindWindow**(None, wndCaption)
            if (None == hWnd):
                        return 0
            else:
                        return 1

We need to get access to some Win32 API (FindWindow, PostMessage and so on) and we need to know how to do so with the new JNA distro.

Thanks in advance.
Best regards.

Stefano.

JNA is a 3rd party library and was never included in Java, despite what the package name might suggest.

I’d guess your problem is more related to the upgrade from JDK 8 to JDK 11 and you might need to upgrade to a later JNA version and make sure the dependencies are being packaged with your module.

edit: oops, this isn’t about a module, but the point that JNA is not part of Java still stands. Somebody must have added the JNA libraries to either Ignition or directly to the Java installed on the client/server machines making those calls.

1 Like