Forum > PDAs and Smartphones

RxLib compatibility issue with WINCE

(1/1)

swierzbicki:
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: ---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; 

--- End code ---



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


--- Code: ---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; 
--- End code ---
 


Thank you

Navigation

[0] Message Index

Go to full version