Главная страница | назад





Article #16410: How can I use a true DWORD value passed to my Delphi application?

 Question and Answer Database
FAQ1410D.txt How can I use a true DWORD value passed to my Delphi application?
Category :VCL
Platform :All
Product :All 32 bit
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}
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99