一段C++程序用Delphi来改写:
void CRecycleBinDlg::HeaderFolder2 ()
{
    TCHAR szTemp[MAX_PATH];
    LPMALLOC pMalloc = NULL;
    HRESULT hr = S_OK;
    SHELLDETAILS sd;
    int iSubItem = 0;
    
    SHGetMalloc(&pMalloc); // windows memory management pointer 
                               // needed later    // We'are asking the object the list of available columns.
    // For each, we are adding them to the control in the right order.
    while (SUCCEEDED (hr))
    {
        hr = m_pFolder2->GetDetailsOf (NULL , iSubItem, &sd);
        if (SUCCEEDED (hr))
        {
            switch (sd.str.uType)
            {
            case STRRET_CSTR:
                _tcscpy (szTemp, sd.str.cStr);
                break;
            case STRRET_OFFSET:
                break;
            case STRRET_WSTR:
                WideCharToMultiByte (CP_ACP, 0, sd.str.pOleStr, -1, 
                                     szTemp, sizeof (szTemp), NULL, NULL);
                pMalloc->Free (sd.str.pOleStr);
                break;
            }
            m_List.InsertColumn (iSubItem , szTemp, LVCFMT_LEFT, 100);
            iSubItem ++;
        }
    }
    pMalloc->Release();
}
改写为:
procedure TForm1.HeaderFolder2;
var
  pMalloc: IMalloc;
  hr: Integer;
  iSubItem: Integer;
  sd: SHELLDETAILS;
begin
   iSubItem:=0;
   SHGetMalloc(pMalloc);
   while(hr=0) do
   begin
      hr:=m_pFolder2.GetDetailsOf(nil,iSubItem,sd);
      if(hr=0) then
      begin
          case sd.str.uType of
          STRRET_CSTR:
              这里要怎么办?
          case STRRET_OFFSET:
          case STRRET_WSTR:
                WideCharToMultiByte (CP_ACP, 0, sd.str.pOleStr, -1,
                                     szTemp, sizeof (szTemp), NULL, NULL);
                pMalloc->Free (sd.str.pOleStr);
                break;          end;
      end;
   end;
end;现在有两个问题:
1、C++中的这一句:TCHAR szTemp,查了下MSDN:
The TCHAR data type is a Win32 character string that can be used to describe ANSI, double-byte character set (DBCS), or Unicode strings. For ANSI and DBCS platforms, TCHAR is defined as shown in the following Syntax section. For Unicode platforms, TCHAR is defined as synonymous with the WCHAR type.
似乎是Ansi Char,也可以是WideChar,那么在Delphi中用什么类型来代替?2、_tcscpy 在C++中应当是字符串拷贝函数,在Dephi中应当怎么写?