Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Delphi 2007 to Rad Studio 10.2


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0 Threads: [ Previous | Next ]
Harry Oudenhoven

Posts: 1
Registered: 4/23/09
Delphi 2007 to Rad Studio 10.2  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2018 1:23 PM
I recently tried out the newest version of Embarcadero - 10.2. When I ran an older Delphi 2007 program under it everything compiled all-right, but I got Chinese characters where I expected to get English! That was from a USB call where I was trying to retrieve the descriptor. I have read that the default string type has changed from 8-bit to 16-bit unicode, but I don't know how to fix the problem. My (partial) code is as follows:

procedure TfrmMain.tb02PollDevicesClick(Sender: TObject);
var
NumDevices: DWORD;
I: DWORD;
DeviceStr: SI_DEVICE_STRING; // array of char
Options: DWORD;
sDeviceList: TStrings;
begin
NumDevices := 0;
//
SiStat := SI_GetNumDevices(NumDevices);
if SiStat <> SI_SUCCESS then
begin
HandleError('GetNumDevices in tb02PollDevices1Click', SiStat);
Exit;
end;
//
sDeviceList := TStringList.Create;
for I := 0 to NumDevices - 1 do
begin
Options := $00000000;
SiStat := SI_GetProductString(I, @DeviceStr, Options);
if (SiStat <> SI_SUCCESS) then
begin
HandleError('GetProductString in tb02PollDevices1Click', SiStat);
Exit;
end;
sDeviceList.Append(DeviceStr);
cboDevices.Items.Add(string(DeviceStr));
end;
//
Any help would be appreciated. Thanks, hlo.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02