On May 13, 2008, at 8:18 AM, Dale...@coats.com wrote:
I worked through many theories (ByteBuffer, WString,
Structure.ByValue,
Pointer, etc) but nothing I've tried got me very far with being able
to
supply a wchar_t into a Structure. I figure that one of the things
I've been trying will work if I just get some more implementation
details right.
'x' shows as the "tool tip" if I do this:
public static class NOTIFYICONDATA extends Structure {
public int cbSize;
public HANDLE hWnd; // HWND.setPointer(aJWindow) keeps XP happy,
btw!
public int uID;
public int uFlags;
public int uCallbackMessage;
public HANDLE hIcon;
public char szTip = 'x';
}
Nominally, a wide native string, "const wchar_t *" is represented in
Java by WString. Otherwise, Java "char" maps to native "wchar_t".
If you look at the W32API definitions in JNA, though, you'll see that
you can automagically convert String into "const wchar_t *" by using
the DEFAULT_OPTIONS supplied for initializing a library. These
options install a type converter and function mapper that
automatically handle windows ascii vs unicode modes.