65.9K
CodeProject 正在变化。 阅读更多。
Home

CCodecList

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.23/5 (8投票s)

2005年9月7日

viewsIcon

37023

downloadIcon

585

一个类,它使用注册表检索本地计算机上找到的编解码器列表。

代码的作用

CCodecList 类使用注册表检索本地计算机上找到的编解码器列表。

如何使用

Zip 文件包含一个简单的演示。如下所示

#include "stdafx.h"
#include "CodecList.h"

CCodecList codec; // an object of CCodecList class

int main()
{
    system ("color 5F"); // color
    system ("title Codecs list using the registry..."); // a title

    int nb = codec.m_aCodec.GetCount(); // number of Codec(s)

    if(nb > 0) // Show a list only if at least one Codec is found.
    {
        // loop until we find a Codecs and show (it) them.
        for (int i = 0; i < codec.m_aCodec.GetCount(); i++)
        {
            printf("%s\r\n", codec.m_aCodec[i]);
        }

        printf("\r\n\r\n"); 

        // Here we show numbers of Codecs found.
        printf("--> Found %i Codecs installed on local computer.\r\n\r\n", 
                                           codec.m_aCodec.GetCount());
    }

    else // No Codecs found, inform user.
    {
        printf("No Codecs found.\r\n\r\n");
    }
    

    system("pause"); 
    return 0;
}

限制

在 Windows XP SP1 上测试过,可以正常工作。需要注意的是:某些编解码器的描述无法检索,例如 "ffdshow" 和 "mastroka" 的情况。要检索有关编解码器的更多信息,您应该使用 WMI。

© . All rights reserved.