1, 在CButton的SetIcon函数中,如何才能指定Icon的尺寸呢?
2, 如何在资源中删除某Icon中的不需要的尺寸?
各20分,谢谢!

解决方案 »

  1.   

    1、用PrivateExtractIcons 提取Icon
    2、UpdateResource ,前提是你得找到相应Icon资源的handle
      

  2.   

    谢谢四星战士的回复,
    忘了说一点,VC6中
    1,PrivateExtractIcons这个函数在msdn中查不到。
       CButton::SetIcon中没有选择尺寸的项。2,我是指 编译前如何在 Resource中操作来删除,VC6 画icon时只有一个 新增工具.
       //我已找到,在菜单中 Image->Delete Device Image 来删除当前的 不需要的icon.
       //以前很少用菜单
       //所有40分移动到 问题 1 中,谢谢.
      

  3.   

    PrivateExtractIcons FunctionCreates an array of handles to icons that are extracted from a specified file.Syntax    UINT PrivateExtractIcons(      
            LPCTSTR lpszFile,
            int nIconIndex,
            int cxIcon,
            int cyIcon,
            HICON *phicon,
            UINT *piconid,
            UINT nIcons,
            UINT flags
        );Parameters    lpszFile
            [in] Pointer to a null-terminated string that specifies the path and name of the file from which the icon(s) are to be extracted.
        nIconIndex
            [in] Specifies the zero-based index of the first icon to extract. For example, if this value is zero, the function extracts the first icon in the specified file.
        cxIcon
            [in] Horizontal icon size wanted. See res.
        cyIcon
            [in] Vertical icon size wanted. See res.
        phicon
            [out] Pointer to the returned array of icon handles.
        piconid
            [out] Pointer to a returned resource identifier for the icon that best fits the current display device. The returned identifier is 0xFFFFFFFF if the identifier is not available for this format. The returned identifier is 0 if the identifier cannot otherwise be obtained.
        nIcons
            [in] Specifies the number of icons to extract from the file. This parameter is only valid when extracting from .exe and .dll files.
        flags
            [in] Specifies flags that control this function. These flags are the LR_* flags used by the LoadImage function.Return Value    If the phicon parameter is NULL and this function succeeds, then the return value is the number of icons in the file. If the function fails then the return value is 0.    If the phicon parameter is not NULL and the function succeeds, then the return value is the number of icons extracted. Otherwise, the return value is 0xFFFFFFFF if the file is not found.Res    This function extracts from executable (.exe), DLL (.dll), icon (.ico), cursor (.cur), animated cursor (.ani), and bitmap (.bmp) files. Extractions from Microsoft Windows 3.x 16-bit executables (.exe or .dll) are also supported.    The cxIcon and cyIcon parameters specify the size of the icons to to extract. Two sizes can be extracted by putting the first size in the LOWORD of the parameter and the second size in the HIWORD. For example, MAKELONG(24, 48) for both the cxIcon and cyIcon parameters would extract both 24 and 48 size icons.    You must destroy all icons extracted by PrivateExtractIcons by calling the DestroyIcon function.    Although you can access this function by using LoadLibrary and GetProcAddress combined in Windows versions prior to Windows XP, the function was not accessible using the standard Include file and library linkage. In Windows XP Service Pack 1 (SP1) and Windows Server 2003 this function is now documented and made accessible using the appropriate include file and library linkage. However, this function is deprecated not intended for general use. It is recommended that you do not use it in new programs because it might be altered or unavailable in subsequent versions of Windows. Function Information    Minimum DLL Version user32.dll
        Header Declared in winuser.h
        Import library user32.lib
        Minimum operating systems Windows 2000
        Unicode Implemented as ANSI and Unicode versions.