jna

Pointer to array of structures as JNA method arguments

爷,独闯天下 提交于 2019-12-05 12:02:39
I am trying to create a JNA implementation over the SctpDrv library. My problem is that I don't get my head around pointers to structure arrays. I have tried to search for a solution, but they have always been slightly different from what I need to know. The JNA dokumentation only show an example with a pointer to an array of primitive type. There also seem to be different ways of doing this, of which some are depricated. int WSAAPI internal_sctp_getpaddrs (SOCKET, sctp_assoc_t, struct sockaddr **); void WSAAPI internal_sctp_freepaddrs (struct sockaddr *); According to the documentation the

JNA Struct and Pointer mapping

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 07:30:48
How does one map the function below to java? VOID WriteToStruct(BOOL *Status, STRUCT_MSG RecBuff) What this function does: 1) Populates the struct RecBuff 2) Updates status How do I map to a boolean pointer in Java and access the struct data updated by the function? I was searching for another issue concerning JNA and structs, and Google redirected me here. I hope this helps. From JNA API To pass a structure by value, first define the structure, then define an empty class from that which implements Structure.ByValue. Use the ByValue class as the argument or return type. // Original C code

Can't set always-on-top for external applications in Java / C++

一笑奈何 提交于 2019-12-05 03:00:19
问题 I'm looking for solution to make external application (not windows application like notepad or calc.exe) to stay always-on-top after pressing the button in Java GUI. I'm using this code in C++ for taking all opened windows on desktop and matching their Process ID (PID) with sent PID (from my app in Java) : #include "cjni.h" #include <cstdlib> #include <iostream> #include <windows.h> using namespace std; BOOL CALLBACK EnumWindowsProc(HWND windowHandle, LPARAM lParam){ DWORD searchedProcessId =

Closing a hook that captures global input events

六眼飞鱼酱① 提交于 2019-12-05 02:57:24
问题 Intro Here is an example to illustrate the problem. Consider I am tracking and displaying mouse global current position and last click button and position to the user. Here is an image: To archive capturing click events on windows box, that would and will be sent to the other programs event messaging queue, I create a hook using winapi namely user32.dll library. This is outside JDK sandbox, so I use JNA to call the native library. This all works perfectly, but it does not close as I expect it

Transparent, click-through, always on top JFrame [closed]

假如想象 提交于 2019-12-05 02:00:26
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . So I currently have a transparent JFrame that you can click through, but I need it to stay on top of all other windows. Let's say you have a browser open, I want the JFrame to stay on top of it but be able to

How would I map this Delphi function with JNA

别来无恙 提交于 2019-12-05 01:49:51
问题 I have the following Delphi function: function DoX(const InputBuffer: Pointer; const InputBufferSize: longword; OutputBuffer: Pointer; var OutputBufferSize: longword): longbool; The OutputBuffer and OutputBufferSize would be set in the function as part of the result, with a boolean return to indicate whether the method was successful (InputBuffer & OutputBuffer would be byte arrays). I have managed to map some of my required functions from the dll with JNA and they are working ok, however

Get events from OS

孤人 提交于 2019-12-04 22:20:28
I work on windows but I am stuck here on Mac. I have the Canon SDK and have built a JNA wrapper over it. It works well on windows and need some help with Mac. In the sdk, there is a function where one can register a callback function. Basically when an event occurs in camera, it calls the callback function. On windows, after registering, I need to use User32 to get the event and to dispatch the event by: private static final User32 lib = User32.INSTANCE; boolean hasMessage = lib.PeekMessage( msg, null, 0, 0, 1 ); // peek and remove if( hasMessage ){ lib.TranslateMessage( msg ); lib

Java: load shared libraries with dependencies

依然范特西╮ 提交于 2019-12-04 22:12:21
问题 I am wrapping a shared library (written in C) with Java using JNA. The shared library is written internally, but that library uses functions from another external library, which again depends another external library. So the situation is something like this: ext1 <- ext2 <- internal I.e. the internal uses external library ext2 which again uses external library ext1. What I have tried is: System.loadLibrary("ext1"); System.loadLibrary("ext2"); NativeLIbrary.loadLibrary("internal",xxx.class);

GetWindowTextA, GetWindowText returns empty value on Edit Control

邮差的信 提交于 2019-12-04 15:33:08
I'm trying to list and get the content of Edit Controls from an external Window in C++ / Java, unfortunately with no success. When I call GetWindowText or GetWindowTextA it returns an empty value on Edit Controls, I know there are some differences between GetWindowText / GetWindowTextW and GetWindowTextA but I don't know What I'm doing wrong since it works on all other controls. Here the C++ Code: BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { cout <<"----------CHILD------------"<<endl; char class_name[80]; char title[80]; GetClassName(hwnd,class_name, sizeof(class_name));

Using jna to keyhook and consume

女生的网名这么多〃 提交于 2019-12-04 12:25:35
I'm making an auto clicker that uses jna to hook global input from the keyboard and mouse. For the keyboard hook im using http://code.google.com/p/goldriver/source/browse/trunk/king/src/jnacontrib/w32keyhook/KeyHook.java?r=36 . I was wondering if there was any possible way to consume the key event so other applications don't process it? Fixed with return new LRESULT (1); Now I'm having a problem with it not continuing with the rest of the code, here is the source. My program keeps listening for keyboard input and doesn't continue to even show the GUI. public class GUI extends javax.swing