Registriert seit: 6. Mär 2013
6.214 Beiträge
Delphi 10 Seattle Enterprise
|
AW: Inkompatible Handle-Typen erstellen
3. Jan 2022, 20:08
Delphi-Quellcode:
program Project1;
type
TWindowHandle = record
var handle: THandle;
class operator Implicit( const handle: THandle): TWindowHandle;
end;
TProcessHandle = record
var handle: THandle;
class operator Implicit( const handle: THandle): TProcessHandle;
end;
class operator TWindowHandle.Implicit( const handle: THandle): TWindowHandle;
begin
Result.handle := handle;
end;
class operator TProcessHandle.Implicit( const handle: THandle): TProcessHandle;
begin
Result.handle := handle;
end;
var
rawHandle: THandle;
windowHandle: TWindowHandle;
processHandle: TProcessHandle;
begin
rawHandle := 1234;
windowHandle := rawHandle;
processHandle := rawHandle;
// windowHandle := processHandle; // E2010 Incompatible types
end.
|
|
Zitat
|