ExtractIconEx("Shell32.dll", 0, largeIcon, smallIcon, 250); if (MIcon == MessageBoxIcon.Error | MIcon==MessageBoxIcon.Hand)
{
MessageBeep(30);
frmIcon = Icon.FromHandle(largeIcon[109]);
}我每次取到第十次的时候就报错 
Icon.FromHandle(largeIcon[109]);
因为这里传进去的是 0
怎么回事呢?

解决方案 »

  1.   

    largeIcon[109]是个什么东西?这个109从哪里来的?因为这里传进去的是 0
    ----------
    那说明largeIcon[109]是0 啊,你要去找有哪些代码涉及到largeIcon的操作了。
      

  2.   

    IntPtr[] largeIcon=new IntPtr[250];
    IntPtr[] smallIcon=new IntPtr[250];
    ExtractIconEx("Shell32.dll", 0, largeIcon, smallIcon, 250);
    就是将 图片读到 largeIcon,smallIcon 里面去 
    我没有用DestroyIcon  
    跟这个有关系么?
      

  3.   

    DestroyIcon   的参数具体该传谁 ? frmIcon .handle ?
      

  4.   

    http://www.pinvoke.net/default.aspx/shell32/ExtractIconEx.htmllargeIcon[109]为0说明没有获取到图标的句柄,就不要调用Icon.FromHandle了.最好要记得调用DestroyIcon 来释放资源.
      

  5.   

    Thank You 
    我来试试