创建一个进度条,显示进度的示例代码如下:
void Test_Progress()
{
FR_UIProgress uipro;
uipro = FRUIProgressCreate(FRAppGetMainFrameWnd(), true);
FS_WideString localLang = FSWideStringNew();
FRLanguageGetLocalLangName(&localLang);
FS_LPCWSTR lpcwstr = FSWideStringCastToLPCWSTR(localLang);
if (FSWideStringEqual(localLang, L"zh-CN"))
{
FRUIProgressSetText(uipro, L"正在转换...");
}
else
{
FRUIProgressSetText(uipro, L"Converting...");
}
// lpcwstr)
int n_1oop = 10; int n_set = 0;
while (n_1oop-- > 0) {
n_set += 10;
FRUIProgressSetCurrValue(uipro, n_set);
Sleep(500);
}
if (uipro != nullptr) {
FRUIProgressDoCancel(uipro, true);
FRUIProgressDestroy(uipro);
}
}
请您注意,进度条不能在线程里销毁。进度条UI是要阻塞当前进程,让界面上不能操作其它;如果在线程里销毁会抛异常。