我在一个项目中初始化已经成功并能够正常使用,可是在另一个项目中却总是失败。
代码如下:
static INITCOMMONCONTROLSEX iccex = {sizeof(INITCOMMONCONTROLSEX),
ICC_LINK_CLASS};//超链接控件类
if (!InitCommonControlsEx(&iccex))
{
MessageBox(NULL, TEXT("初始化公共控件失败"), TEXT("关闭"), MB_OK);
break;
}
为什么总是弹出"初始化公共控件失败"这个对话框呢?

解决方案 »

  1.   

    你可以看一下返回值或调用GetLastError看一下是什么错误.
      

  2.   

    也许是你的IE没有装好吧.好多公用控件都需要IE相应版本的支持.
      

  3.   

    GetLastError返回2,"系统找不到指定的文件"。不知道为什么是这个值??
    另外,与IE没有关系,因为我在另一个项目中已经使用过这个控件了。
      

  4.   

    我又试了一下,好象只有使用ICC_LINK_CLASS时才会失败,这是为什么? 
    好奇怪啊?我在另一项目中已经使用过了,这次怎么就不行了呢?
    难道与项目设置有关?
      

  5.   

    我又试了一下,好象只有使用ICC_LINK_CLASS时才会失败,这是为什么? 
    好奇怪啊?我在另一项目中已经使用过了,这次怎么就不行了呢?
    难道与项目设置有关?
    ============ 哪会是那一个文件呢?
      

  6.   

    InitCommonControlsEx
    Registers specific common control classes from the common control dynamic-link library (DLL). BOOL InitCommonControlsEx(
        LPINITCOMMONCONTROLSEX lpInitCtrls
    );Parameters
    lpInitCtrls 
    Address of an INITCOMMONCONTROLSEX structure that contains information specifying which control classes will be registered. 
    Return Values
    Returns TRUE if successful, or FALSE otherwise. Res
    Note The effect of each call to InitCommonControlsEx is cumulative. For example, if InitCommonControlsEx is called with the ICC_UPDOWN_CLASS flag, then is later called with the ICC_HOTKEY_CLASS flag, the result is that both the up-down and hot key common control classes are registered and available to the application. Requirements 
      Version 4.70 and later of Comctl32.dll  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 3.0 and later). 
      Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 3.0 or later). 
      Header: Declared in commctrl.h. 
      Import Library: comctl32.lib.