- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

How can I use a true DWORD value passed to my Delphi application?

Question:

How can I use a true DWORD value passed to my Delphi application?

Answer:

One solution is to convert the DWORD to a comp.

Example:

{$IFOPT Q+}
  {$DEFINE OVERFLOWSON}
  {$Q-}
{$ENDIF}

function DWordToComp(dw : longint) : comp;
var
  c : comp;
begin
  if u >= 0 then
    c := dw else begin
    c := $7FFFFFFF;
    if dw = -1 then
      c := c + c + 1
    else
      c := c + abs($7FFFFFFF - dw);
  end;
  result := c;
end;

{$IFDEF OVERFLOWSON}
  {$UNDEF OVERFLOWSON}
  {$Q+}
{$ENDIF}



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile