Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Apr : Convert Unicode to String

www.cryer.info
Managed Newsgroup Archive

Convert Unicode to String

Subject:Convert Unicode to String
Posted by:"Pierre Y." (pierre..@gmail.com)
Date:Tue, 3 Apr 2007 19:37:18

Hello,

In IpHlpAPI.pas, the TMibIfRow is declared as this :

_MIB_IFROW = record
    wszName: array [0..MAX_INTERFACE_NAME_LEN - 1] of WCHAR;
    dwIndex: DWORD;
    dwType: DWORD;
    dwMtu: DWORD;
    ...
  end;
  MIB_IFROW = _MIB_IFROW;
  TMibIfRow = MIB_IFROW;
  PMibIfRow = PMIB_IFROW;

I would like to show the wszName in a Delphi 2006 Application.

I tried to convert the PWideChar like this :

procedure FaisUnTrucAvecUneIfRow(IfRow: PMibIfRow);
var
  W: PWideChar;
  S: String;
begin
  W := IfRow^.wszName;
  S := WideCharToString(W);
  ShowMessage(S);
end;

But it don't works. Do you know how to convert such an unicode string
to Delphi 2006 string ?

Many thanks, best regards,

--
Pierre Y.

Replies:

www.cryer.info
Managed Newsgroup Archive