• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I map native HWND type from JNA?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic