Where in the patch is this code? I cannot find this ....

Maybe you forgot to include modifications to wswin32tryicon.pas to the patch?

Also this kind of modification will have to be reverted when a real
TIcon is implemented.


1. a real TIcon will never be implemented becouse no os than win32 supports icons maybe someone can nclude those code in ticon to generate the handle there ...

2. all changes in this patch goes to wswin32trayicon or i need glasses ...

here an copy of thw patch :


Index: components/trayicon/wswin32trayicon.pas
===================================================================
--- components/trayicon/wswin32trayicon.pas (Revision 8867)
+++ components/trayicon/wswin32trayicon.pas (Arbeitskopie)
@@ -57,6 +57,48 @@
  szClassName = 'TTrayIconClass';
  szAppTitle = 'apptitle';

+function BitmapToIcon(Bitmap: TBitmap): HIcon;
+var
+  IconSizeX, IconSizeY : integer;
+  IconInfo: TIconInfo;
+  IconBitmap, MaskBitmap: TBitmap;
+  x, y: Integer;
+  TransparentColor: TColor;
+begin
+  IconSizeX := GetSystemMetrics(SM_CXSMICON);
+  IconSizeY := GetSystemMetrics(SM_CYSMICON);
+  IconBitmap:= TBitmap.Create;
+  IconBitmap.Width:= IconSizeX;
+  IconBitmap.Height:= IconSizeY;
+  IconBitmap.Canvas.StretchDraw(Rect(0, 0, IconSizeX, IconSizeY), Bitmap);
+  IconBitmap.TransparentColor:= Bitmap.TransparentColor;
+
+  IconBitmap.Transparent := True;
+  IconBitmap.TransparentMode := tmAuto;
+
+  TransparentColor:= IconBitmap.TransparentColor and $FFFFFF;
+  MaskBitmap:= TBitmap.Create;
+  MaskBitmap.Monochrome := True;
+  MaskBitmap.Width:= IconSizeX;
+  MaskBitmap.Height:= IconSizeY;
+  MaskBitmap.Canvas.Brush.Color := clNone;
+  MaskBitmap.Canvas.Rectangle(0,0,IconSizeX,IconSizeY);
+  for y:= 0 to IconSizeY - 1 do
+    for x:= 0 to IconSizeX - 1 do
+      if IconBitmap.Canvas.Pixels[x, y] = TransparentColor then
+        IconBitmap.Canvas.Pixels[x, y]:= clDontMask;
+  IconInfo.fIcon:= True;
+  IconInfo.xHotspot := 0;
+  IconInfo.yHotspot := 0;
+  IconInfo.hbmMask:= MaskBitmap.handle;
+  IconInfo.hbmColor:= IconBitmap.Handle;
+  Result := CreateIconIndirect(IconInfo);
+  MaskBitmap.Free;
+  IconBitmap.Free;
+end;
+
+
+
{*******************************************************************
*  TrayWndProc ()
*
@@ -270,7 +312,7 @@
  tnid.uFlags := NIF_MESSAGE or NIF_ICON;
  if ShowHint then tnid.uFlags := tnid.uFlags or NIF_TIP;
  tnid.uCallbackMessage := WM_USER + uID;
-  tnid.hIcon := Icon.Handle;
+  tnid.hIcon := BitmapToIcon(Icon);
  buffer := PChar(Hint);
  StrCopy(@tnid.szTip, buffer);


_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to