本文整理汇总了C++中Registry::GetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Registry::GetItem方法的具体用法?C++ Registry::GetItem怎么用?C++ Registry::GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::GetItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendCommandLineToRealJukebox
bool SendCommandLineToRealJukebox()
{
bool result = false;
Registrar registrar;
Registry formatRegistry;
Win32Prefs prefs;
vector<DownloadFormatInfo*> formats;
// init
registrar.SetSubDir("plugins");
registrar.SetSearchString("*.dlf");
registrar.InitializeRegistry(&formatRegistry, &prefs);
const RegistryItem* module = NULL;
DownloadFormat* dlf = NULL;
int32 i = 0;
while((module = formatRegistry.GetItem(i++)))
{
dlf = (DownloadFormat*) module->InitFunction()(NULL);
if(dlf)
{
DownloadFormatInfo dlfi;
uint32 index = 0;
// error != kError_NoMoreFormats
while(IsntError(dlf->GetSupportedFormats(&dlfi, index++)))
{
dlfi.SetRef(dlf);
formats.push_back(new DownloadFormatInfo(dlfi));
}
}
}
vector<DownloadFormatInfo*>::iterator dlfIter;
if(__argc > 1)
{
char* extension;
extension = strrchr(__argv[1], '.');
if(extension)
{
extension++;
for(dlfIter = formats.begin();
dlfIter != formats.end();
dlfIter++)
{
if(!strcasecmp(extension, (*dlfIter)->GetExtension()))
{
vector<DownloadItem*> items;
char url[MAX_PATH + 7];
uint32 size = sizeof(url);
Error err;
err = FilePathToURL(__argv[1], url, &size);
if(IsntError(err))
{
(*dlfIter)->GetRef()->ReadDownloadFile(url,
&items);
vector<DownloadItem*>::iterator dliIter;
for(dliIter = items.begin();
dliIter != items.end();
dliIter++)
{
MetaData metadata = (*dliIter)->GetMetaData();
if( strcasecmp("mp3", metadata.FormatExtension().c_str()) &&
strcasecmp("mp2", metadata.FormatExtension().c_str()) &&
strcasecmp("mp1", metadata.FormatExtension().c_str()) &&
strcasecmp("m3u", metadata.FormatExtension().c_str()) &&
strcasecmp("pls", metadata.FormatExtension().c_str()) )
{
bool rjFound = false;
result = true;
LONG regErr;
HKEY key;
regErr = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\realjbox.exe",
0,
KEY_WRITE|KEY_READ,
&key);
if(regErr == ERROR_SUCCESS)
{
char buf[MAX_PATH*2];
DWORD len = sizeof(buf);
DWORD type;
//.........这里部分代码省略.........