I see thanks Michael. The reason I had the version of user32 was because that's
the one in the code snippet on the project homepage
https://jna.dev.java.net/#callbacks and I only found out about the examples.jar
after I'd written that test version and didn't notice that that version differed
from the actual version in the examples package.
Thanks for you help, I think I've pretty much got it now!
----- Original Message ----
From: Michael Brewer-Davis <mich...@tech4learning.com>
To: use...@jna.dev.java.net
Sent: Tuesday, 2 September, 2008 11:39:05
Subject: Re: [jna-users] Trouble getting started with window enumeration
Caused by: java.lang.UnsatisfiedLinkError: Error looking up function
'GetWindowText': The specified procedure could not be found.Native
Method)CallbackReference.java:274)CallbackReference.java:296)Native
Method)Function.java:282)Function.java:223)Library.java:204)Test.java:17)at
com.sun.jna.Function.<init>(
Your User32 class should extend W32API, like the example version (why
not just use the included example User32?)
The inside of it is that Windows defines two versions of many string
functions--an ASCII version and a Unicode (wide char) version. So
user32.dll doesn't export GetWindowText, it exports GetWindowTextA and
GetWindowTextW. The W32API class takes care of these things, allowing
you to call GetWindowText (and you can specify when creating the library
which of these two you want, should you care. Default is Unicode.)