Getting active window information in Java

Save yourself some pain and use JNA. You will need to download jna.jar and jna-platform.jar for the Win32 API. The pinvoke wiki and MSDN are useful for finding the right system calls. Anyway, here is the code to print the title and process of the currently active window. import static enumeration.EnumerateWindows.Kernel32.*; import static enumeration.EnumerateWindows.Psapi.*; import … Read more

How to call a method in DLL in a Java program

From the source: package jnahelloworldtest; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.NativeLong; import com.sun.jna.Platform; import com.sun.jna.*; /** Simple example of native library declaration and usage. */ public class Main { public interface simpleDLL extends Library { simpleDLL INSTANCE = (simpleDLL) Native.loadLibrary( (Platform.isWindows() ? “simpleDLL” : “simpleDLLLinuxPort”), simpleDLL.class); // it’s possible to check the platform on which … Read more

Skip window from being captured

If I understood correctly your problem. You can use built in Flex/as3 function to take a screenshot of the entire application or a particular component then convert into bytearray and PngEncoder (or JPGEncoder if you prefer), than save it… Here’s an example: <?xml version=”1.0″ encoding=”utf-8″?> <s:WindowedApplication xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark” xmlns:mx=”library://ns.adobe.com/flex/mx”> <fx:Script> <![CDATA[ import mx.graphics.codec.PNGEncoder; private function … Read more

How do I properly map a `MagImageScalingCallback` using JNA?

The callback is proper – there is no flaw in your code, besides you are using deprecated functions. Consider using this: try { Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage capture = new Robot().createScreenCapture(screenRect); ImageIO.write(capture, “JPEG”, new File(“printed1.jpg”)); } catch (Exception e) { e.printStackTrace(); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)