I realise this is a stupid question but I want to make sure I am not doing something wrong.
I am using some API functions (which are DELPHI based) and one of these functions is used to retrieve information about items. If there is no information available to retrieve for a given item, the documentation states (for the API function in question) : "If no textual designation is retrieved, the first character in the buffer is set to NULL."
So the function call looks like this :
The_API_FunctionName( LONG ItID, LPWSTR lpDescr, DWORD nBufferLengthAndFlags) : LONG
And so one of my example calls is :
{$mode Delphi}{$H+}
....
const
BufLen=256;
...
var
itemtypeinfo : integer;
lpDescr : array[0..Buflen-1] of WideChar;
...
begin
...
itemtypeinfo := FunctionName(ItID, @lpDescr, SizeOf(lpDescr) + $40000000);
...
end;
That works fine for items where a textual description is returned for lpDescr.
However, I am trying to catch the occurrences where nothing is returned in lpDescr. My understanding from the documentation is that is achieved by assessing the first value of the lpDescr array, or, more precisely, the buffer pointer, which is set to NULL if its empty. I THINK I can do that by executing :
if @lpDescr[0] = nil then // assess if the first value of lpDescr is NULL
begin
// Do something to take care of the emtpiness
end;
It compiles OK, but never executes, even when I know some of the items have no value to return so it must empty several times. So I am assuming I am assessing the first character of lpDescr incorrectly or I am assessing the pointer to it incorrectly?
Can anyone help?