11.07.2010, 12:28
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
var
MyIcon: TIcon;
begin
MyIcon := TIcon. Create;
try
MyIcon.Handle := ExtractIcon(hInstance, 'MYPROG.EXE', 0)
{Здесь можно что-нибудь сделать с иконкой}
finally
MyIcon.Free;
end;
end;
Цитата:
Если можно просто извлечь, значит так же просто, можно и поменять!!!
|
Код:
unit acWorkRes;
interface
uses Windows;
function BeginUpdateResourceW (fileName : PWideChar;
delExistingRes : bool ) : dword; stdcall;
function EndUpdateResourceW (update : dword;
discard : bool ) : bool; stdcall;
function UpdateResourceW (update : dword;
type_ : PWideChar;
name : PWideChar;
language : word;
data : pointer;
size : dword ) : bool; stdcall;
function BeginUpdateResourceS(const Filename: String; const delExistingRes: Boolean): DWORD; stdcall;
function ReplaceIconGroupResourceS(const hUpdate: DWORD; const Name: PChar; const Language: Word; const IconFile: String): Boolean; stdcall;
function EndUpdateResource(const hUpdate: DWORD; const Discard: Boolean): Boolean; stdcall;
function GetResourceW (update : dword;
type_ : PWideChar;
name : PWideChar;
language : word;
var data : pointer;
var size : dword ) : bool; stdcall;
type
TPIconGroup = ^TIconGroup;
TIconGroup = packed record
reserved : word;
type_ : word;
itemCount : word;
items : array [0..maxInt shr 4 - 1] of packed record
width : byte;
height : byte;
colors : byte;
reserved : byte;
planes : word;
bitCount : word;
imageSize : dword;
id : word;
end;
end;
TPIcoHeader = ^TIcoHeader;
TIcoHeader = packed record
reserved : word;
type_ : word;
itemCount : word;
items : array [0..maxInt shr 4 - 1] of packed record
width : byte;
height : byte;
colors : byte; // 0 for 256+ colors
reserved : byte;
planes : word;
bitCount : word;
imageSize : dword;
offset : dword; // data offset in ico file
end;
end;
// get the specified icon group resource header
function GetIconGroupResourceW (update : dword;
name : PWideChar;
language : word;
var iconGroup : TPIconGroup) : bool; stdcall;
// save the specified icon group resource to an ico file
function SaveIconGroupResourceW (update : dword;
name : PWideChar;
language : word;
icoFile : PWideChar) : bool; stdcall;
// load the specified ico file into the resources
// if the icon group with the specified already exists, it gets fully replaced
function LoadIconGroupResourceW (update : dword;
name : PWideChar;
language : word;
icoFile : PWideChar) : bool; stdcall;
// delete the whole icon group including all referenced icons
function DeleteIconGroupResourceW (update : dword;
name : PWideChar;
language : word ) : bool; stdcall;
// ***************************************************************
// bitmap specific functions
// save the specified bitmap resource to a bmp file
function SaveBitmapResourceW (update : dword;
name : PWideChar;
language : word;
bmpFile : PWideChar) : bool; stdcall;
// load the specified bmp file into the resources
function LoadBitmapResourceW (update : dword;
name : PWideChar;
language : word;
bmpFile : PWideChar) : bool; stdcall;
// ***************************************************************
////////////////////////////////// Alx ///////////////////////////
var
notLang: Boolean = False;
function GetImageNtHeaders(module: dword) : PImageNtHeaders;
function IntToHexEx(value : integer;
minLen : integer = 1;
fillChar : char = '0') : string; overload;
function SaveIconGroupResource(update: dword;
name: PWideChar;
icoFile: PWideChar) : bool; stdcall;
function GetNameIcon(update: dword; ind: Integer) : WideString; stdcall;
//////////////////////////////////////////////////////////////////
implementation
<опущено 30Кб>
end.
это я и хотел сказать)
|