Главная страница | назад





Article #17767: Storing icons in your application for use at runtime?

 Question and Answer Database

FAQ2767D.txt   Storing icons in your application for use at runtime?
Category   :Object Pascal
Platform    :All
Product    :All 32 bit  

Question:
How can I store icons in my application and use them at runtime?


Answer:
Create a resource file containing the icons you wish to use, then
use the Windows API function LoadIcon(),

Example:

{$R MYRES.RES}

procedure TForm1.Button1Click(Sender: TObject);
var
  h : hIcon;
begin
  h := LoadIcon(hInstance, 'ICON_1');
  Application.Icon.Handle := h;
  InvalidateRect(Application.Handle, nil, true);
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99