jna

jna multiprocess

i'm using jna to glue fortran and java together, and it works great. except for one thing. i have two jvm processes, each of which uses the same shared library. individually, they work fine. calling one, and then the other, also works. but then calling the first one again, segv's. the code doesn't do anything interesting; it copies...

JNA Pointer cast to struct

I have a pointer in a struct. And I passed a struct pointer to this pointer. But I could not type cast back to this pointer to struct. public class Test { // Pointer ptr = new Memory(4); } public class Temp extends Structure { // } Test tst = new Test(); Temp tmp = new Temp(); tst.ptr = tmp.getPointer(); ... Temp...

JNA calling a function which takes a pointer to a pointer to an array

I am trying to call the C function sane_get_devices from Java using JNA SANE_Status sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only); Where SANE_Status is an int and SANE_Device is a structure. typedef struct { SANE_String_Const name; /* unique device name */ SANE_String_Const vendor; /* device vend...

Working example of JNA mouse hook

Can any one provide me with a working example of JNA mouse hook, which would be able to track mouse movements/click outside my Java Swing application ? Thanks in Advance ...

Java on Windows: how to delete a file to trash (using JNA)

I'm not experiences with Windows API at all, so please excuse my ignorance. I want to delete files to the trash. How to do that using JNA and how to detect if this would not be possible, e.g., because the files are located on a network share? ...

Access C++ shared library from Java: JNI, JNA, CNI, or SWIG?

Which of the following (or other) method would you recommend for accessing a C++ shared library from Java and why? JNI: I hear this has a number of pitfalls and is quite the undertaking? SWIG: Apparently this makes using JNI easier, but I've heard it has some problems too? JNA: I could write a C interface and then use JNA with it i...

Java JNA does not seem to be working

I recently downloaded the Java JNA from https://jna.dev.java.net/servlets/ProjectDocumentList?folderID=7408&expandFolder=7408&folderID=0 and tried using it. However, as exemplified by the screenshot below, the demo source code provided in https://jna.dev.java.net/ won't compile, no matter where I place the files. Mind you, I've t...

How do i use JNA with a linked list on Solaris

How do i use JNA with a linked list on Solaris ...

What is the correct JNA mapping for UniChar on Mac OS X?

I have a C struct like this: struct HFSUniStr255 { UInt16 length; UniChar unicode[255]; }; I have mapped this in the expected way: public class HFSUniStr255 extends Structure { public UInt16 length; // UInt16 is just an IntegerType with length 2 for convenience. public /*UniChar*/ char[] unicode = new char[255]; ...

Disable Background drawing in JFrame in order to properly display Aero (DWM) effects.

I'm having problems using the DWM functionality of Windows Vista/7 on Java windows. I want to make the background of my frame use the Aero style. The Windows API to do so is provide by the function DwmExtendFrameIntoClientArea in the dwmapi library. I've managed to call the procedure properly via JNA, and it does what it is supposed to d...

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

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. ...

How does Snag.IT/snipping tool create captures of a window and obfuscate the background? Which dll's to use?

Hi, I have been busy creating a screen capture function in Java using JNA (java native access). So far I have been able to do a lot, but I am baffled about some things a bit. The OS is Windows, if you wonder.... I find it easy to capture, for example, a region, or a window, but find it hard to draw over it. The reason for this is the...

What is the Java type for *short using JNA

What is the Java type for *short using JNA I have in my dll short and *short, so how can I call short -> int *short -> int[]? Thanks, Alex ...

How to create a Microsoft Windows Child window using JNA

Hi, I have spent some time trying to create a child window of an existing window by using the following piece of code on JNA (Java Native Access) but I guess it is pretty much the same with every other programming language trying to use Windows API. Here is my declaration of CreateWindowsExA : public int CreateWindowExA(int i, Strin...

Create a native Windows window in JNA and some GetWindowLong with GWL_WNDPROC

Good day, I have been using JNA for a while to interact with the Windows API and now I am stuck when creating a window. As far as I have done the following: 1. Have created a child window of an existing window and obtained a valid handler to it. 2. Understood that every window in Windows has a non-stop message-dispatch loop. 3. Understo...

How to add a button to a window that I haven't created in windows using JNA (user32 or whatever dll)

Hi, I have been trying to do the following thing in windows, using JNA: add a button to a window that I haven't created. First, however, I would like to create a WNDPROC listener so I know what messages are being sent. The problem is that messages are not being sent/received in the message pump, while they should be (because windows co...