Recent

Author Topic: RxLib compatibility issue with WINCE  (Read 4281 times)

swierzbicki

  • Full Member
  • ***
  • Posts: 177
RxLib compatibility issue with WINCE
« on: August 20, 2013, 05:46:32 pm »
Hello,

 I tried the rxlib SVN version but was not able to use this library under WinCE.
I'm getting errors with string conversion that doesn't exists on Wince :

Code: [Select]
function StrToOem(const AnsiStr: string): string;
begin
{$IFDEF WINDOWS}
  SetLength(Result, Length(AnsiStr));
  if Length(Result) > 0 then
    CharToOemBuff(PChar(AnsiStr), PChar(Result), Length(Result));
{$ELSE}
  Result:=AnsiStr;
{$ENDIF}
end;

function OemToAnsiStr(const OemStr: string): string;
begin
{$IFDEF WINDOWS}

  SetLength(Result, Length(OemStr));
  if Length(Result) > 0 then
    OemToCharBuff(PChar(OemStr), PChar(Result), Length(Result));
{$ELSE}
  Result:=OemStr;
{$ENDIF}
end; 



Is it safe to declare them this way for the Wince platform ?

Code: [Select]
function StrToOem(const AnsiStr: string): string;
begin
{$IFDEF WINDOWS}
 {$IFNDEF WINCE}
  SetLength(Result, Length(AnsiStr));
  if Length(Result) > 0 then
    CharToOemBuff(PChar(AnsiStr), PChar(Result), Length(Result));
  {$ELSE}
  Move(PChar(AnsiStr)^, Pchar(Result)^, Length(Result));
  {$ENDIF}
{$ELSE}
  Result:=AnsiStr;
{$ENDIF}
end;

function OemToAnsiStr(const OemStr: string): string;
begin
{$IFDEF WINDOWS}
   {$IFNDEF WINCE}
  SetLength(Result, Length(OemStr));
  if Length(Result) > 0 then
    OemToCharBuff(PChar(OemStr), PChar(Result), Length(Result));
  {$ELSE}
  Move(PChar(OemStr)^, Pchar(Result)^, Length(Result));
  {$ENDIF}
{$ELSE}
  Result:=OemStr;
{$ENDIF}
end; 
 


Thank you
« Last Edit: August 21, 2013, 11:39:35 am by swierzbicki »
Lazarus 1.6.2
fpc 3.0.0
wince/win32/win64
delphi berlin

 

TinyPortal © 2005-2018