Mega Code Archive

 
Categories / Delphi / Graphic
 

Storing icons in your application for use at runtime

Title: Storing icons in your application for use at runtime 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;