File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes How can I map native HWND type from JNA? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How can I map native HWND type from JNA?" Watch "How can I map native HWND type from JNA?" New topic

How can I map native HWND type from JNA?

Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
I am trying to access a dll through JNA.
the dll contains a method

I am new to JNA. I tried to went through the tutorials and examples. so far I've understood is- I have done the following thing:

the opensamplesystem() method executes and returns 0 which, according to the dll documentation, is ok.
but the problem is with the startsamplesystem(HWND wid, int mid, int devices, int protocol, int message) where I am not sure how to map HWND data type from my code.

would anyone please show me some way?

thanks in advance
Rob Spoor

Joined: Oct 27, 2005
Posts: 20275

In short, HWND is another name for HANDLE which is another name for PVOID which is another name for void*, or a pointer of any type.

Well, that is one possible type definition. I've checked my MinGW's windef.h. It says that DECLARE_HANDLE is a macro from winnt.h with two possible definitions:
The second is what's described above: HWND is HANDLE is PVOID is void*. The first still says that HANDLE is void* but without the intermediate PVOID. HWND though is a pointer to a struct with one int element (if my C knowledge doesn't desert me). Not exactly the same.

Still, in the end there is one common type: a generic pointer. I think you can use the Pointer class for that.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: How can I map native HWND type from JNA?
It's not a secret anymore!