Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I map native HWND type from JNA?

 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20605
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://stackoverflow.com/questions/90493/long-to-hwnd-vs8-c

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic