|
-
Feb 18th, 2004, 09:19 AM
#1
Thread Starter
New Member
IDL Import
Hi,
I have an IDL file with this structure inside:
typedef union abc
{
int Rogerio;
LPWSTR valString;
} _ABC;
When I generate the type library and make a reference in a vb.net project I cannot see the union members. But if I don't use the LPWSTR valString item, it appears with no problem.
So my question is: why using LPWSTR in unions make the whole union members not accessible?
Thanks!
-
Feb 18th, 2004, 11:52 AM
#2
Sleep mode
You might need to ask C++ guys why !
-
Feb 19th, 2004, 08:57 AM
#3
Thread Starter
New Member
Solution
Hi,
I've found a way:
It is possible to declare the variable as a wchar_t * .
The vb.net see the variable as a System.IntPtr pointer.
So, now it is necessary only to read the string from the memory pointer. This can be done by : Marshal.PtrToStringAuto(memoryAddress).
The final code will be like this:
typedef union abc
{
int a;
wchar_t * b;
} _abc;
the vb code:
dim x as _abc
' Reading the data from memory
Dim MyString As String = Marshal.PtrToStringAuto(x.b)
That is it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|