Hi Nigel,
+ lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(WCHAR)*(nLength+1));
+ MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,(nLength+1));
+ lpwszUrl[nLength] = 0;
The last line is redundant: the HeapAlloc already zeroes the buffer.
Though since MultiByteToWideChar is already overwriting the buffer,
you might remove the HEAP_ZERO_MEMORY and leave this assignment.
--Juan