110,535
社区成员
发帖
与我相关
我的任务
分享
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct ExifInfoType
{
//char CameraMake [32];
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public StringBuilder CameraMake;
//int DateTimeOffsets[MAX_DATE_COPIES];
const int MAX_DATE_COPIES = 100; //sample value
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DATE_COPIES)]
public int[] DateTimeOffsets;
}
更多用法 ,请参见:
Marshaling Data with Platform Invoke
http://msdn.microsoft.com/en-us/library/fzhhdwae(v=vs.100).aspxtypedef struct {
char CameraMake [32];
char CameraModel [40];
char DateTime [20];
int Height, Width;
int Orientation;
int IsColor;
int Process;
int FlashUsed;
float FocalLength;
float ExposureTime;
float ApertureFNumber;
float Distance;
float CCDWidth;
float ExposureBias;
float DigitalZoomRatio;
int FocalLength35mmEquiv; // Exif 2.2 tag - usually not present.
int Whitebalance;
int MeteringMode;
int ExposureProgram;
int ExposureMode;
int ISOequivalent;
int LightSource;
char Comments[MAX_COMMENT];
unsigned ThumbnailOffset; // Exif offset to thumbnail
unsigned ThumbnailSize; // Size of thumbnail.
unsigned LargestExifOffset; // Last exif data referenced (to check if thumbnail is at end)
char ThumbnailAtEnd; // Exif header ends with the thumbnail
// (we can only modify the thumbnail if its at the end)
int ThumbnailSizeOffset;
int DateTimeOffsets[MAX_DATE_COPIES];
int numDateTimeTags;
int GpsInfoPresent;
char GpsLat[31];
char GpsLong[31];
char GpsAlt[20];
} ExifInfo_t;
/////////////////////
struct ExifInfoType
{
char[] CameraMake=new char [32];//[32]
char[] CameraModel = new char[40];
char[] DateTime = new char[20];
int Height, Width;
int Orientation;
int IsColor;
int Process;
int FlashUsed;
float FocalLength;
float ExposureTime;
float ApertureFNumber;
float Distance;
float CCDWidth;
float ExposureBias;
float DigitalZoomRatio;
int FocalLength35mmEquiv; // Exif 2.2 tag - usually not present.
int Whitebalance;
int MeteringMode;
int ExposureProgram;
int ExposureMode;
int ISOequivalent;
int LightSource;
char [] Comments=new char [MAX_COMMENT];
UInt16 ThumbnailOffset; // unsigned ThumbnailOffset; // Exif offset to thumbnail
UInt16 ThumbnailSize;// unsigned ThumbnailSize; // Size of thumbnail.
UInt16 LargestExifOffset; // unsigned LargestExifOffset; // Last exif data referenced (to check if thumbnail is at end)
char ThumbnailAtEnd; // Exif header ends with the thumbnail
// (we can only modify the thumbnail if its at the end)
int ThumbnailSizeOffset;
int[] DateTimeOffsets=new int [MAX_DATE_COPIES];
int numDateTimeTags;
int GpsInfoPresent;
char[] GpsLat=new char [31];
char[] GpsLong=new char [31];
char[] GpsAlt=new char [20];
} ;
出现的问题,请帮助解决。