#defineEASYFILENAMELENG1024structuEasyFileInfo_st{ unsignedintStructSize; intreserved; __int64create_time; _...
#define EASYFILENAMELENG 1024struct uEasyFileInfo_st{ unsigned int StructSize; int reserved; __int64 create_time; __int64 modify_time; __int64 size; unsigned long attrib; char pFilename[EASYFILENAMELENG];};这是dll文件的 api的调用说明int WINAPI RequestFindFileOpenExt( uecHandle EasyFileHandle, const char* pPath, uEasyFileInfo_st* pfileinfo ) EasyFileHandle[in] uEasyFileClient_COM_Start和uEasyFileClient_USB_Start返回的句柄pPath [in] 指向开始查找的目录,如果Server端是PT800系列,此参数应该为 "*.*"pfileinfo [out] 指向 uEasyFileInfo_st 结构体的指针,查找到的文件信息将填入到这个结构体中。 /*下面是我写的 但是程序报错*/下面是我写的结构体 public struct uEasyFileInfo_st { public UInt32 StructSize; public int reserved; public Int64 create_time; public Int64 modify_time; public Int64 size; public UInt32 attrib; public string[] pFilename; }这是我C#引入的dll调用[DllImport("uEasyFileClient.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]public static extern int RequestFindFileOpenExt(IntPtr EasyFilehandle, string pPath, ref uEasyFileInfo_st pfileinfo);C#中的调用(调试时报:尝试读取或写入受保护的内存。这通常指示其他内存已损坏) IntPtr uecHandle=new IntPtr(); private void button3_Click(object sender, EventArgs e) { NLSClass.uEasyFileInfo_st temp = new NLSClass.uEasyFileInfo_st(); int i = NLSClass.RequestFindFileOpenExt(uecHandle, "*.*", ref temp); }
展开