11 messages in net.java.dev.jna.usersRe: [jna-users] char* versus wchar_t ...
FromSent OnAttachments
Dale...@coats.comMay 13, 2008 5:17 am 
Timothy WallMay 13, 2008 6:00 am 
Timothy WallMay 13, 2008 6:05 am 
Dale...@coats.comMay 13, 2008 8:55 am 
Timothy WallMay 13, 2008 9:06 am 
Dale...@coats.comMay 13, 2008 11:46 am.zip
Daniel KaufmannMay 13, 2008 5:16 pm 
Dale...@coats.comMay 14, 2008 5:02 am 
Timothy WallMay 14, 2008 6:10 am 
Dale...@coats.comMay 15, 2008 6:33 am 
Timothy WallMay 15, 2008 12:38 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] char* versus wchar_t * in a StructureActions...
From:Timothy Wall (twal@dev.java.net)
Date:May 15, 2008 12:38:10 pm
List:net.java.dev.jna.users

On May 15, 2008, at 9:33 AM, Dale@coats.com wrote:

Does Structure.size() return the same thing as sizeof(NOTIFYICONDATA) in native code? If not, you may be missing some field definitions.

I don't know how to check the sizeof(NOTIFICATIONICONDATA). Would I just write a C program that built the structure in the same way I'm trying in JNA, and then call that method?

Just include the appropriate header, then do a printf of the value of sizeof(NOTIFICATIONICONDATA). You can use mingw/cygwin gcc if you don't have msvc.

I've calculated it manually and I think it was close, but not exactly what I calculated. Although my calculation was what I suspected was wrong, still, I punched in that value instead of the results of size(), but didn't see improvement.

With respect to "missing some field definitions", I saw that the NOTIFYICONDATA structure, as defined in MSDN, has been growing as the OS's grew. I've been using the smallest set of fields; I don't expect all fields are required or tray icons written for WIN2K, for instance, would blow up on WINXP. As long as the cbSize field is right for the structure, it seems like the OS should be happy with it.

You're right, the smallest size should work as long as cbSize is set correctly.

Is there a way to dump the exact bytes contained in memory under a structure? Since I've got one that works, and the supposed equivalent one that doesn't, it would be interesting to see just what is different.

If you set the system property jna.dump_memory, Structure.toString will dump the native memory contents as well as individual field values.