A new version of WinRun4J is available. …

A new version of WinRun4J is available. It contains the following fixes and new features:

  • Major new feature is the dynamic native binding. This provides the ability to use native Windows API functions without having to write any JNI/native code. See native binding examples for more information.
  • Fixed a race condition in the service implementation for quick starting applications.
  • The launcher java library now requires java 1.5 minimum (due to use of annotations). The launcher executable is compatible with java 1.4 and above.
  • Fixed lowercased key issue with INI file
  • Fixed max heap size issue on 64-bit VM
  • Added option to set console title via INI file
  • Added option to suppress error popups
  • DDE activate message sends command line

The following shows a simple example of the native binding:

package org.boris.winrun4j.test;

import org.boris.winrun4j.PInvoke;
import org.boris.winrun4j.PInvoke.DllImport;
import org.boris.winrun4j.PInvoke.UIntPtr;

public class BindingExample1
{
    @DllImport("kernel32")
    public static native boolean GetComputerName(StringBuilder lpBuffer, UIntPtr lpnSize);
    
    public static void main(String[] args) throws Exception {
        StringBuilder name = new StringBuilder();
        UIntPtr size = new UIntPtr(100);
        if (GetComputerName(name, size)) {
            System.out.println(name);
        }
    }

    static {
        PInvoke.bind(BindingExample1.class);
    }
}

You can download the new version from the WinRun4J Sourceforge Site.

Thanks to everyone who found bugs and gave suggestions.

Advertisements