我的程序加上VclSkin之后,关闭程序报地址错误。

解决方法:将WinSkinForm.pas单元中,如下代码的第26行注释掉就OK了。
procedure TWinSkinForm.GetIcon(var bmp:Tbitmap);
var
  SmallIcon: HIcon;
  cx, cy,i: Integer;
  sd:Tskindata;
begin
      cx := GetSystemMetrics(SM_CXSMICON);
      cy := GetSystemMetrics(SM_CYSMICON);
//      bmp.Assign(nil);
//      bmp.canvas.brush.color:=clFuchsia;
      bmp.width:=cx;bmp.height:=cy;
      bmp.PixelFormat := pf16bit;
      bmp.Canvas.Brush.color:=clFuchsia;
      bmp.canvas.fillrect(rect(0,0,cx,cy));
      iconx:=cx;
      // First try a small icon, then a big icon
      DefIcon := SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0);
      if DefIcon = 0 then
        DefIcon := SendMessage(hwnd, WM_GETICON, ICON_BIG, 0);

      if DefIcon <> 0 then begin
        SmallIcon := CopyImage(DefIcon, IMAGE_ICON, cx, cy, LR_COPYFROMRESOURCE);
        DrawIconEx(bmp.Canvas.Handle, 0, 0, SmallIcon,
            cx, cy, 0, 0, DI_MASK or DI_IMAGE );//DI_NORMAL);
        DestroyIcon(SmallIcon);
      //end else if not fsd.sysicon.empty then  begin //otherwise no icon found   --------------------------------------就这行啦
         //cause DLL exception
         //bmp.assign(fsd.sysicon) ;
         //bmp.PixelFormat := pf24bit;
         //copybmp(sd.SysIcon,bmp);
      end else begin
         for i:= 0 to skinmanager.dlist.count-1 do begin
             sd:= Tskindata(skinmanager.dlist.items[i]);
             if sd.skinformtype=sfMainform then begin
                if not sd.sysicon.empty then
                   //copybmp(sd.SysIcon,bmp);
                   //bmp.assign(sd.sysicon) ;
             end;
         end;
      end;
end;

 

 

 

http://bbs.csdn.net/topics/310075391

posted @ 2014-01-04 12:13  hanks  阅读(127)  评论(0)    收藏  举报