Hi Patrick,
Create a .Net assembly target in PB.Net (I called mine "hex_to_ascii")
Add a function that takes a string and returns a string
Make sure you check the box on the project to expose your function (I called mine "HexToAscii").
Build it.
Run regasm to make it visible to PB Classic. (Don't forget to add Wow6432Node entries)
Add the code to call it from PB Classic
///////////////////////////////////////////////////////////// PB.Net code
// replace 0x with x
hexString = hexString.Replace("0x", "x");
// create array out of string
System.String lsTemp[]
lsTemp = hexString.Split('x')
System.Text.StringBuilder sb
sb = create System.Text.StringBuilder
long ll
for ll = 1 to lsTemp.Length
// make sure we have something to process
if lsTemp[ll] <> "" then
sb.Append(System.Convert.ToChar(System.Convert.ToUInt32(lsTemp[ll], 16)));
end if
next
string lsRet
lsRet = sb.ToString()
destroy sb
return lsRet
//////////////////////////////////////////////////////// PB Classic code
oleobject lo_hex
int li_ret
lo_hex = create oleobject
li_ret = lo_hex.ConnectToNewobject( "hex_to_ascii.n_customnonvisual")
if li_ret <> 0 then
st_1.text = string(li_ret)
else
st_1.text = lo_hex.HexToAscii(sle_1.text)
end if
destroy lo_hex
hth,
Mark