كما يتضح من عنوان الموضوع
هنا سأضع كود يمكننا من الحصول على جميع الـ GDI Objects الموجودة حالياً في النظام
ربما قد يحتاجها أحدهم ....
const
EntriesQty = 16384; // GDI handles limitation
type
TGdiTableCell = record
pKernelInfo : pointer;
ProcessId : WORD;
Count : WORD;
Upper : WORD;
HandleType : WORD;
pUserInfo : pointer;
end;
TGdiTable = array [0..EntriesQty-1] of TGdiTableCell;
PGdiTable = ^TGdiTable;
function GdiQueryTable(): PGdiTable; stdcall;external 'gdi32.dll' name 'GdiQueryTable';
procedure GetGDIObjects();
var
Table : PGdiTable;
i : integer;
begin
Table := GdiQueryTable;
try
for i := 0 to EntriesQty-1 do begin
with Table^ do begin
if(ULONG(pKernelInfo) >= $80000000)then // valid pointer to kernel address space
begin
//Here we do what we want of the data we got
// To get the handle of the object use ((upper shl 16) or i)
end {if};
end {with};
end {for};
except
//Here we write our exception
end {try};
end;لمعلومات عن GDI Objects وانواعها يرجى الإطلاع على MSDN
لمعلومات عن GdiQueryTable , TGdiTableCell يرجى الإطلاع على المرجع الرائع
Windows Graphics Programming Win32 GDI and DirectDraw by FengYuan
فيه شرح رائع وهناك شفرات برمجية رائعة مرفقة مع الكتاب
