

![]() | 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.userschar* versus wchar_t * in a Structure| 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: | char* versus wchar_t * in a Structure | Actions... |
|---|---|---|
| From: | Dale...@coats.com (Dale...@coats.com) | |
| Date: | May 13, 2008 5:17:37 am | |
| List: | net.java.dev.jna.users | |
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'; }
But I need to get a bunch of chars into szTip, though. I'll admit to trying char[] and String, but of course that just displayed the pointer related to those objects.
So how to define the szTip?
I found this, and I think it's getting me pretty close to where I want to go:
On Feb 5, 2008, at 11:06 AM, Timothy Wall wrote:
Since the buffer is within a structure, you will need to define the field as a Pointer and assign it a sufficiently large Memory block. If you use a primitive array within a structure, it will be inlined, which is not what you want here. After the call, you can use Pointer.getString(0, true) to retrieve the string.
I don't want to "get" the String so much as "set" it. So here's what I tried:
pnid.szTip = Pointer.createConstant(64L); pnid.szTip.setString(0, "testing tip");
But I got:
This pointer is opaque: opaque@0x40
This might be waaaay off the mark, I know, but my "theory" when stepping out of the world of Java is lacking, so I've been in novice trial and error mode. I've been trying to absorb some of the related recent Jay Walters discussion, but no breakthroughs on getting wchar_t into my structure.
Any advice as a push in the right direction?
--Dale--
***************************************************
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