Cristian, The following "struct" is the interface used by the platform invoke
code when dealing with FtpFindFirstFile provided by wininet.dll. I think it
will give you the clues you are looking for...Chuck
/// <summary>
//STRUCTURE to hold the directory information - implemented as a class
/// <summary>
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public class FileData {
public int fileAttributes = 0;
// creationTime was embedded FILETIME structure
public int creationTime_lowDateTime = 0 ;
public int creationTime_highDateTime = 0;
// lastAccessTime was embedded FILETIME structure
public int lastAccessTime_lowDateTime = 0;
public int lastAccessTime_highDateTime = 0;
// lastWriteTime was embedded FILETIME structure
public int lastWriteTime_lowDateTime = 0;
public int lastWriteTime_highDateTime = 0;
public int nFileSizeHigh = 0;
public int nFileSizeLow = 0;
public int dwReserved0 = 0;
public int dwReserved1 = 0;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
public String fileName = null;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)]
public String alternateFileName = null;
} //end FileData
"CristianMori" wrote:
Hi there.
In c++ Managed, is there a way to seamless wrap an unmanaged struct in a
managed class without having to write access code for all the memebers?
ie..
typedef struct
{
char Name[50];
long int MagicNumber;
} teststruct;
than I want to write a class
class Test
{
....
public teststruct *mystruct;
}
and then in c#
Test myclass;
myclass.mystruct.MagicNumber = 10;
Thanks in advance