Guyz, please, i'm beaten...
i've got the following code that's written in pascal. i need it translated to c++ ... too tired/little knowledge to do this myself...

function HexFromBin(lpb : pointer; cb : DWORD):string;
var HexStr:string;
i:integer;
begin
SetLength(Result,2*cb);
for i:=0 to cb-1 do begin
HexStr:=IntToHex(TByteArray(lpb^)[i], 2);
Result[2*i+1]:=HexStr[1];
Result[2*i+2]:=HexStr[2];
end;
end;

if any of you can't sleep, feel like giving a hand, i'd really appreciate it.

oh, and btw if you're asking yourself what is this, it's a function that returns a MAPI email message ID. and it is not present in the WM5x/6x libraries.. the only implementation i've found is the one above but it's written in pascal (