X
xkdcc
Unregistered / Unconfirmed
GUEST, unregistred user!
如题。(Delphi2009)我的报错代码是:SetString(Result, StrRet.cStr, lStrLen(StrRet.cStr));我尝试使用SetString(Result, StrRet.cStr, lStrLen(PWideChar(StrRet.cStr)));仍然报错相关结构和函数:procedure SetString(var s: string
buffer: PChar
len: Integer);//system.pasfunction lstrlen
external kernel32 name 'lstrlenW';Syntax int lstrlen( LPCTSTR lpString );Parameters lpString [in] Pointer to a null-terminated string.Return Value The return value specifies the length of the string, in TCHAR values. This refers to bytes for ANSI versions of the function or WCHAR values for Unicode versions. If lpString is NULL, the return value is 0.StrRet是TStrRet类型。TStrRet的定义如下:type{ record for returning strings from IShellFolder member functions } PSTRRet = ^TStrRet
{$EXTERNALSYM _STRRET} _STRRET = record uType: UINT
{ One of the STRRET_* values } case Integer of 0: (pOleStr: LPWSTR)
{ must be freed by caller of GetDisplayNameOf } 1: (pStr: LPSTR)
{ NOT USED } 2: (uOffset: UINT)
{ Offset into ****EMID (ANSI) } 3: (cStr: array[0..MAX_PATH-1] of AnsiChar)
{ Buffer to fill in } end
TStrRet = _STRRET;请大侠指教,多谢!
buffer: PChar
len: Integer);//system.pasfunction lstrlen
external kernel32 name 'lstrlenW';Syntax int lstrlen( LPCTSTR lpString );Parameters lpString [in] Pointer to a null-terminated string.Return Value The return value specifies the length of the string, in TCHAR values. This refers to bytes for ANSI versions of the function or WCHAR values for Unicode versions. If lpString is NULL, the return value is 0.StrRet是TStrRet类型。TStrRet的定义如下:type{ record for returning strings from IShellFolder member functions } PSTRRet = ^TStrRet
{$EXTERNALSYM _STRRET} _STRRET = record uType: UINT
{ One of the STRRET_* values } case Integer of 0: (pOleStr: LPWSTR)
{ must be freed by caller of GetDisplayNameOf } 1: (pStr: LPSTR)
{ NOT USED } 2: (uOffset: UINT)
{ Offset into ****EMID (ANSI) } 3: (cStr: array[0..MAX_PATH-1] of AnsiChar)
{ Buffer to fill in } end
TStrRet = _STRRET;请大侠指教,多谢!