jna

Sending Keystrokes to Hidden Window via JNA

允我心安 提交于 2020-01-25 10:03:10
问题 Background: I'm sending keystrokes to a program (Text Editor) that I hide and then Send the F7 Key and after that four keys of text (kind of a password). I'm using JNA Library and the SendMessage function of Win32API to send the messages, can't use sendInput() because I need to send to a specific window handle. Code: private static void sendInputToWindow(WinDef.HWND editorWindowHandle, char[] password) throws InterruptedException { User32.INSTANCE.ShowWindow(editorWindowHandle, WinUser.SW

Error with package com.sun.glass.ui while learning Java Native Access

梦想的初衷 提交于 2020-01-24 19:24:38
问题 I am trying to use an Undecorated stage in a JavaFX project, stage.initStyle(StageStyle.UNDECORATED); . It is a modular Gradle project. It is also a multi-project build, though because I am working on it in IntelliJ, it might be more appropriate to refer to it as a multi-module build. I wish to be able to add regular functionality to this Undecorated stage. I have already been able to add the usual minimize, restore, and close buttons, but if a user clicks on the program's icon in the Windows

Why do I get java.lang.UnsatisfiedLinkError: Unable to load library?

对着背影说爱祢 提交于 2020-01-24 17:06:05
问题 I am trying to call a .dll file from my Java app using JNA. I am getting the following exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Windows\System32\foo.dll': The specified module could not be found. Both the .dll and my jdk are 32 bit (OS_ARCH="i586") although I am running it on a 64 bit Windows 7 PC. The .dll is in the System32 folder. I am using Eclipse and have added the System32 folder to the Native library location in the JRE System

JNA's W32API.* - where are they?

ⅰ亾dé卋堺 提交于 2020-01-24 04:19:05
问题 I just downloaded both jna.jar and platform.jar (ver. 3.2.7) from http://java.net/projects/jna/downloads/directory/3.2.7 and according to http://jna.java.net/javadoc/platform/com/sun/jna/platform/win32/W32API.html I should find the W32API interface but I can't locate it. Anyone can shed some light on this? Thanks. Best Regards, Joe 回答1: This class has been split up into Multiple classes in 3.2.7. You can either revert to 3.2.5 to get the class as is, or, you can use these newer classes into

Docking a java application jna on windows

 ̄綄美尐妖づ 提交于 2020-01-23 12:06:50
问题 I'm trying to build a Windows dockable application that reserves a section of the screen to prevent other applications from show in that space. I have try using JNI and JNA. The code above shows how far I have got. package jnadock; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.platform.win32.ShellAPI; import com.sun.jna.platform.win32.ShellAPI.APPBARDATA; import com.sun.jna.platform.win32.WinDef.DWORD; import com.sun.jna.platform.win32

MAGIMAGEHEADER in java

爱⌒轻易说出口 提交于 2020-01-17 05:37:10
问题 I am creating class for MAGIMAGEHEADER in Java The Structure of MAGIMAGEHEADER in Winapi is typedef struct tagMAGIMAGEHEADER { UINT width; UINT height; WICPixelFormatGUID format; UINT stride; UINT offset; SIZE_T cbSize; } MAGIMAGEHEADER, *PMAGIMAGEHEADER; I have created a equivalent class in Java. import java.util.Arrays; import java.util.List; public class MAGIMAGEHEADER extends com.sun.jna.Structure { public int width; public int height; public Object format; public int stride; public int

Win32API: how to create a shortcut (.lnk file)

痞子三分冷 提交于 2020-01-16 06:12:18
问题 I'm a Java developer, so please excuse my ignorance. I want to create a shortcut to an executable, e.g., in the user's autostart or send-to folder (I don't want an installer to do that, because the installer usually is run by an administrator). What API (C preferred) I could use for that task (maybe using JNA)? Thanks in advance. 回答1: As @Hans indicated, it requires COM (via ShellLinkObject or WScript.Shell). In Java you can call COM objects using a Java to COM bridge. There are a few

How do I read the contents from an open Windows Console (Command Prompt) using Java Native Access

不想你离开。 提交于 2020-01-15 03:32:09
问题 I want to read the text contents of the command prompt window. Let's say, I opened a command prompt, then ran a dir command and then pwd command. So the problem statement is that, what ever is present in the command prompt I should be able to read them. I am trying to use Java Native Access library for achieving this, but didn't get any luck with it. I have tried following code. But I am not getting any output. import com.sun.jna.Native; import com.sun.jna.platform.win32.User32; import com

DLL issues and Invalid Memory Access

老子叫甜甜 提交于 2020-01-14 10:34:10
问题 So here is my situation. I am tasked with porting over part of a program from pascal written in a delphi IDE, at least I believe, to a Java program. I was not present at the creation of the program being ported over so I have almost no knowledge of the inner workings other than watching what it does as a final product. None-the-less, I have started transferring it over and hit a roadblock with their .dll calls. Their .dll calls are represented here: unit impdll; interface uses Classes,

JNA: key listener + JFrame

北战南征 提交于 2020-01-14 06:03:46
问题 I'm trying to write a simple application where I have a keyboard listener in the background and JFrame. Practically, I use the following code to create the listener: public class KeyHook { private static volatile boolean quit; private static HHOOK hhk; private static LowLevelKeyboardProc keyboardHook; public static void main(String[] args) { final User32 lib = User32.INSTANCE; HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null); keyboardHook = new LowLevelKeyboardProc() { public LRESULT