返回列表 发帖

[技术讨论] VBS如何把string转换成byte()?

网上的方法 来自demon.tw 大佬的代码么 就是抄来抄去
'Author: Demon
'Website: http://demon.tw
'Date: 2012/2/22
Dim xmldoc, node, bytes
Set xmldoc = CreateObject("Msxml2.DOMDocument")
Set node = xmldoc.CreateElement("binary")
node.DataType = "bin.hex"
'demon.tw 的十六进制值为
'64 65 6D 6F 6E 2E 74 77
node.Text = "64656D6F6E2E7477"
bytes = node.NodeTypedValue
WScript.Echo VarType(bytes), TypeName(bytes)COPY
有些离谱的是如果用以上代码WScript.Echo bytes 会输出一堆乱码
完全有更简单的方法
set v=createobject("wia.vector")
v.setfromstring("balabala")
msgbox typename(v.binarydata)COPY
1

评分人数

    • CrLf: 有趣的方法技术 + 1
你好

MidB和AscB路过

TOP

可是wia.vector的setfromstring得到的是unicode序列的byte()

TOP

回复 3# Five66


    嗯 第一个是gbk的 所以是乱码
你好

TOP

返回列表