This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
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

Win a copy of The Software Craftsman this week in the Agile forum!
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: 19958

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
Have you tried LearnNowOnline?
subject: How can I map native HWND type from JNA?