Delphi-Quellcode:
const
EXTEND_EXTRA = 10;
procedure SetProperty(WinHandle: HWND; Item: integer; V: integer);
begin
if (Item > 0) and (Item < EXTEND_EXTRA + 1) and (WinHandle <> 0) then
SetWindowLong(WinHandle, (Item - 1) * 4, V);
end;
function GetProperty(WinHandle: HWND; Item: integer): integer;
begin
Result := 0;
if (Item > 0) and (Item < EXTEND_EXTRA + 1) and (WinHandle <> 0) then
Result := GetWindowLong(WinHandle, (Item - 1) * 4);
end;
procedure Test;
var
Item: integer;
V: integer;
DesktopDeviceContext: HDC;
I: Integer;
begin
for I := 0 to 100 do
begin
Item := 1;
DesktopDeviceContext := GetDC(0);
SetProperty(0, Item, DesktopDeviceContext);
V := GetProperty(0, Item);
end;
end;
Bitte obigen Code mal ausführen.
Was passiert bei eingeschalteter Bereichs- und Überlaufprüfung und warum?