

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
11 messages in net.java.dev.jna.users[jna-users] char* versus wchar_t * in...| From | Sent On | Attachments |
|---|---|---|
| Dale...@coats.com | May 13, 2008 5:17 am | |
| Timothy Wall | May 13, 2008 6:00 am | |
| Timothy Wall | May 13, 2008 6:05 am | |
| Dale...@coats.com | May 13, 2008 8:55 am | |
| Timothy Wall | May 13, 2008 9:06 am | |
| Dale...@coats.com | May 13, 2008 11:46 am | .zip |
| Daniel Kaufmann | May 13, 2008 5:16 pm | |
| Dale...@coats.com | May 14, 2008 5:02 am | |
| Timothy Wall | May 14, 2008 6:10 am | |
| Dale...@coats.com | May 15, 2008 6:33 am | |
| Timothy Wall | May 15, 2008 12:38 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [jna-users] char* versus wchar_t * in a Structure | Actions... |
|---|---|---|
| From: | Dale...@coats.com (Dale...@coats.com) | |
| Date: | May 15, 2008 6:33:23 am | |
| List: | net.java.dev.jna.users | |
On Wed, 14 May 2008 09:10:45 -0400, Timothy Wall wrote:
You should null-terminate any of the szXXX fields, unless you know the array is already zeroed.
You're right, of course. I got sloppy in my iterative testing.
Also remember that Java objects will be GC'd if you don't keep a reference to them; structures will be freed, and callbacks will become no-ops.
No problem there.
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? 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. But since it wasn't that hard, I tried it with all the fields for WIN2K. It showed the same problem as before. There's one more field for WINXP, but I didn't go there because I didn't know how to map a GUID. I didn't try that hard because I doubt it would make a difference anyway.
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.
--Dale--
NOTIFYICONDATA structure: http://msdn.microsoft.com/en-us/library/bb773352%28VS.85%29.aspx
***************************************************
This communication may be confidential and privileged and the views expressed
herein may be personal and are not necessarily the views of Coats plc. It is for
the exclusive use of the intended recipient(s). If you are not the intended
recipient(s), please note that any distribution, copying or use of this
communication or the information in it is strictly prohibited. If you have
received this communication in error, please notify us by email
(Apps...@coats.com) or telephone our technical support helpdesk at Coats
plc. +44 (0)20 8210 5100 (UK 0830H - 1800H, Mon-Fri, GMT) and then delete the
email and any copies of it.
***************************************************








.zip