delphi 如何替换其他exe的主图标
来源:百度知道 编辑:UC知道 时间:2024/06/07 08:40:44
所以,在此请求各位的帮助,本人感激不尽。
给你一段读写自身icon的程序。写别的程序的,只需要loadlibrary,用它的句柄代替hinstance.
PCursorOrIcon = ^TCursorOrIcon;
TCursorOrIcon = packed record
Reserved: Word;
wType: Word;
Count: Word;
end;
//This has been defined in DELPHI9. But not the definition of IconEntry.
PIconEntry = ^TIconEntry;
TIconEntry= packed record
bWidth : Byte; // Width, in pixels, of the image
bHeight : Byte; // Height, in pixels, of the image
bColorCount: Byte; // Number of colors in image (0 if >=8bpp)
bReserved: Byte; // Reserved ( must be 0)
wPlanes : word; // Color Planes
wBitCount : word; // Bits per pixel
dwBytesInRes : dword; // How many bytes in this resource?
dwImageOffset : dword;
end;
var
hRes,hMem:HRSRC;
lpMem : Pointer;
lp1 : PBYTE;
n : integer;
ts : TMemoryStream;
IconHeader : TCursorOrIcon;