HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON1);
HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON2);
HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON3);
是否可以呢?

解决方案 »

  1.   

    不需要
    Do not destroy a shared icon. A shared icon is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared icon. LoadIcon
    LoadImage (if you use the LR_SHARED flag) 
    CopyImage (if you use the LR_COPYRETURNORG flag and the hImage parameter is a shared icon) 
    CreateIconFromResource
    CreateIconFromResourceEx (if you use the LR_SHARED flag)
      

  2.   

    HICON hIcon;while( true )
    {
          hIcon =AfxGetApp()->LoadIcon(IDI_ICON1);
    }不会内存泄露 , 不会有持续内存飙升  就可以