widestring->pchar或
widestring->string都可以

解决方案 »

  1.   

    你的widestring是什么啊?
    如果是简单的字符串,系统可以自动转换成string的。
      

  2.   

    强制转换
    WideString(string的变量)
    AnsiString(widestring的变量)
      

  3.   

    下面是摘自于TntUnicodeControls之TntSystem.pas的修改函数:
    =======================================================
    function WideStringToStringEx(const WS: WideString; CodePage: Cardinal): AnsiString;
    var
      InputLength,
      OutputLength: Integer;
    begin
      //if CodePage = CP_UTF7 then
      //  Result := WideStringToUTF7(WS) // CP_UTF7 not supported on Windows 95
      //else if CodePage = CP_UTF8 then
      //  Result := WideStringToUTF8(WS) // CP_UTF8 not supported on Windows 95
      //else begin
        InputLength := Length(WS);
        OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, nil, 0, nil, nil);
        SetLength(Result, OutputLength);
        WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, PAnsiChar(Result), OutputLength, nil, nil);
      //end;
    end;
    =================================================
    调用:
    {简体}
    wcs:WideString;
    acs:String;wcs:='简体';//这只是用于示例acs:=WideStringToStringEx(wcs,936{简体编码GBK的代码页(CodePage)});{繁体}
    wcs:WideString;
    acs:String;wcs:='繁體';//这只是用于示例acs:=WideStringToStringEx(wcs,950{繁体编码BIG5的代码页(CodePage)});