|
发表于 2021-7-11 04:39:12
|
显示全部楼层
本帖最后由 bestkakkoii 于 2021-7-11 04:44 编辑
个人也在这块苦恼了很久
最后用VB调用才实现,但效率很差,最后硬去学了C++写插件效果差很多
C**t 不知道為啥被*掉了 C o n s t
- function ReadBinary(FilePath)
- var Code = "Function ReadBinary(FileName):"
- Code = Code & "C**t adTypeBinary = 1:"
- Code = Code & "Dim stream, xmldom, node:"
- Code = Code & "Set xmldom = CreateObject("Microsoft.XMLDOM"):"
- Code = Code & "Set node = xmldom.CreateElement("binary"):"
- Code = Code & "node.DataType = "bin.hex":"
- Code = Code & "Set stream = CreateObject("ADODB.Stream"):"
- Code = Code & "stream.Type = adTypeBinary:"
- Code = Code & "stream.Open:"
- Code = Code & "stream.LoadFromFile FileName:"
- Code = Code & "node.NodeTypedValue = stream.Read():"
- Code = Code & "stream.Close:"
- Code = Code & "Set stream = Nothing:"
- Code = Code & "ReadBinary = node.Text:"
- Code = Code & "Set node = Nothing:"
- Code = Code & "Set xmldom = Nothing:"
- Code = Code & "End Function"
- var ss = com("ScriptControl")
- ss.Language = "VBScript"
- ss.AddCode(Code)
- var Result = ss.Run("ReadBinary", FilePath)
- return Result
- end
复制代码
C++直接
pFileIn = fopen(path, "rb");
fread(Buffer, Size, Count, pFileIn);
|
|