Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var
IconIndex: word;
Buffer: array[0..2048] of char;
IconHandle: HIcon;
Bitmap : TBitmap;
OpenDialog: TOpenDialog;
begin
OpenDialog := TOpenDialog.Create(nil);
try
if OpenDialog.Execute then
begin
StrCopy(@Buffer, PChar(OpenDialog.FileName));
IconIndex := 0;
IconHandle := ExtractAssociatedIcon(HInstance, Buffer, IconIndex);
if IconHandle <> 0 then
Icon.Handle := IconHandle;
Bitmap := TBitmap.Create;
try
Bitmap.Width := Icon.Width;
Bitmap.Height := Icon.Height;
Bitmap.Canvas.Draw(0, 0, Icon);
SpeedButton1.Glyph.Assign(Bitmap);
finally
Bitmap.Free;
end;
end;
finally
OpenDialog.Free;
end;
end;
var
Bitmap : TBitmap;
begin
Bitmap := TBitmap.Create;
try
Bitmap.Width := Application.Icon.Width;
Bitmap.Height := Application.Icon.Height;
Bitmap.Canvas.Draw(0, 0, Application.Icon);
SpeedButton1.Glyph.Assign(Bitmap);
finally
Bitmap.Free;
end;
end;