以下是从MSDN拷贝过来的,我感觉有错,请帮忙看一下.
for (i=0; ICInfo(fccType, i, &icinfo); i++)
{
hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_QUERY);
if (hic)
{
// Skip this compressor if it can't handle the format.
if (fccType == ICTYPE_VIDEO && pvIn != NULL &&
ICDecompressQuery(hic, pvIn, NULL) != ICERR_OK)
{
ICClose(hic);
continue;
}
// Find out the compressor name.
ICGetInfo(hic, &icinfo, sizeof(icinfo)); //就是这句,我想他应该在ICClose之前
// Add it to the combo box.
n = ComboBox_AddString(hwndC,icinfo.szDescription);
ComboBox_SetItemData(hwndC, n, hic);
}
}
for (i=0; ICInfo(fccType, i, &icinfo); i++)
{
hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_QUERY);
if (hic)
{
// Skip this compressor if it can't handle the format.
if (fccType == ICTYPE_VIDEO && pvIn != NULL &&
ICDecompressQuery(hic, pvIn, NULL) != ICERR_OK)
{
ICClose(hic);
continue;
}
// Find out the compressor name.
ICGetInfo(hic, &icinfo, sizeof(icinfo)); //就是这句,我想他应该在ICClose之前
// Add it to the combo box.
n = ComboBox_AddString(hwndC,icinfo.szDescription);
ComboBox_SetItemData(hwndC, n, hic);
}
}
Query失败,才检查Info,这都是合理的
continue;
注意 continue; 關閉後,就執行下個循環了!!!
解压缩失败就continue否则就Get
没有任何错误!
请你们先用delphi试了 再说。
if (fccType == ICTYPE_VIDEO && // 如果两个相等
pvIn != NULL && // 并且pvIn不为空
ICDecompressQuery(hic, pvIn, NULL) != ICERR_OK // 并且函数执行不成功
)
{ // 就会把hic关闭
ICClose(hic);
continue;
}
// 当上面的if不成立的时候执行下面的语句 // Find out the compressor name.
ICGetInfo(hic, &icinfo, sizeof(icinfo)); //就是这句,我想他应该在ICClose之前这段代码是没有错误的