Analitcs

Pesquisar no conteúdo do blog.atlabs.com.br

sexta-feira, 26 de julho de 2013

DELPHI - Decode URL Reference - Delphi Web Broker.

Reações: 


Tags retirada do endereço:

http://www.w3schools.com/tags/ref_urlencode.asp

Function DecodeURLReference(sText : String) : String;
begin
  Result := sText;
  Result := StringReplace(Result, '%20', ' ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%21', '!', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%22', '"', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%23', '#', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%24', '$', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%25', '%', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%26', '&', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%27', '''', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%28', '(', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%29', ')', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2A', '*', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2B', '+', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2C', ',', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2D', '-', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2E', '.', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%2F', '/', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%30', '0', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%31', '1', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%32', '2', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%33', '3', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%34', '4', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%35', '5', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%36', '6', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%37', '7', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%38', '8', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%39', '9', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3A', ':', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3B', ';', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3C', '<', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3D', '=', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3E', '>', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%3F', '?', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%40', '@', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%41', 'A', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%42', 'B', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%43', 'C', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%44', 'D', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%45', 'E', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%46', 'F', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%47', 'G', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%48', 'H', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%49', 'I', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4A', 'J', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4B', 'K', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4C', 'L', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4D', 'M', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4E', 'N', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%4F', 'O', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%50', 'P', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%51', 'Q', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%52', 'R', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%53', 'S', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%54', 'T', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%55', 'U', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%56', 'V', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%57', 'W', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%58', 'X', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%59', 'Y', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5A', 'Z', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5B', '[', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5C', '\', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5D', ']', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5E', '^', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%5F', '_', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%60', '`', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%61', 'a', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%62', 'b', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%63', 'c', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%64', 'd', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%65', 'e', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%66', 'f', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%67', 'g', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%68', 'h', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%69', 'i', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6A', 'j', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6B', 'k', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6C', 'l', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6D', 'm', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6E', 'n', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%6F', 'o', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%70', 'p', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%71', 'q', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%72', 'r', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%73', 's', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%74', 't', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%75', 'u', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%76', 'v', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%77', 'w', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%78', 'x', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%79', 'y', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7A', 'z', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7B', '{', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7C', '|', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7D', '}', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7E', '~', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%7F', ' ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%80', '`', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%81', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%82', '‚', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%83', 'ƒ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%84', '„', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%85', '…', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%86', '†', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%87', '‡', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%88', 'ˆ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%89', '‰', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8A', 'Š', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8B', '‹', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8C', 'Œ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8D', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8E', 'Ž', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%8F', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%90', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%91', '‘', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%92', '’', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%93', '“', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%94', '”', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%95', '•', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%96', '–', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%97', '—', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%98', '˜', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%99', '™', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9A', 'š', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9B', '›', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9C', 'œ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9D', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9E', 'ž', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%9F', 'Ÿ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A0', ' ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A1', '¡', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A2', '¢', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A3', '£', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A4', '¤', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A5', '¥', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A6', '¦', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A7', '§', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A8', '¨', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%A9', '©', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AA', 'ª', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AB', '«', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AC', '¬', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AD', '­', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AE', '®', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%AF', '¯', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B0', '°', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B1', '±', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B2', '²', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B3', '³', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B4', '´', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B5', 'µ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B6', '¶', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B7', '·', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B8', '¸', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%B9', '¹', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BA', 'º', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BB', '»', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BC', '¼', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BD', '½', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BE', '¾', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%BF', '¿', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C0', 'À', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C1', 'Á', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C2', 'Â', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C3', 'Ã', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C4', 'Ä', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C5', 'Å', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C6', 'Æ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C7', 'Ç', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C8', 'È', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%C9', 'É', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CA', 'Ê', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CB', 'Ë', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CC', 'Ì', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CD', 'Í', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CE', 'Î', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%CF', 'Ï', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D0', 'Ð', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D1', 'Ñ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D2', 'Ò', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D3', 'Ó', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D4', 'Ô', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D5', 'Õ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D6', 'Ö', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D7', '×', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D8', 'Ø', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%D9', 'Ù', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DA', 'Ú', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DB', 'Û', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DC', 'Ü', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DD', 'Ý', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DE', 'Þ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%DF', 'ß', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E0', 'à', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E1', 'á', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E2', 'â', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E3', 'ã', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E4', 'ä', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E5', 'å', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E6', 'æ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E7', 'ç', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E8', 'è', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%E9', 'é', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%EA', 'ê', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%EB', 'ë', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%EC', 'ì', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%ED', 'í', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%EE', 'î', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%EF', 'ï', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F0', 'ð', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F1', 'ñ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F2', 'ò', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F3', 'ó', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F4', 'ô', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F5', 'õ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F6', 'ö', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F7', '÷', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F8', 'ø', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%F9', 'ù', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FA', 'ú', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FB', 'û', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FC', 'ü', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FD', 'ý', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FE', 'þ', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, '%FF', 'ÿ', [rfReplaceAll, rfIgnoreCase]);
end;

terça-feira, 2 de julho de 2013

DELPHI - Icon to BMP / Extract icon windows shell - Icone para Bitmap - Extraindo icone do shell do windows

Reações: 


// troque o valor de '#4' para o que precisar.
Procedure ExtractIconShell;
var
  _H    : THandle;
  _Pic  : TPicture;
  _Icon : TIcon;
  _BMP  : TBitMap;
begin
  _H := LoadLibrary('shell32.dll');
  _Icon:= TIcon.Create;
  _Pic := TPicture.Create;
  _BMP := TBitmap.Create;
  try
    _Icon.Handle := LoadIcon(_H, '#4');
//  _Icon.LoadFromFile(ArquivoIco);
    _Pic.Icon    := _Icon;
    _BMP.Width   := _Icon.Width;
    _BMP.Height  := _Icon.Height;
    _BMP.Canvas.Draw(0, 0, _Pic.Icon);
    _BMP.SaveToFile('C:\Test.BMP');
  finally
    FreeAndNil(_Pic);
    FreeAndNil(_Icon);
    FreeAndNil(_BMP);
    FreeLibrary(_H);
  end;
End;

Max Gehringer