本文整理汇总了C++中Updater::DestroyHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ Updater::DestroyHandle方法的具体用法?C++ Updater::DestroyHandle怎么用?C++ Updater::DestroyHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::DestroyHandle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_update_progress_thread
// поток чтения пайпа
DWORD Updater::read_update_progress_thread(LPVOID param)
{
Updater* updater = static_cast<Updater*>(param);
updater->AddProgressInfo(prog_info::PROGRESS_START);
for (;;)
{
std::string output;
const int BUFSIZE = 1024;
char chBuf[BUFSIZE];
DWORD dwRead;
DWORD ec = 0; //exit code
DWORD bytesAvailable = 0;
while (PeekNamedPipe(updater->_hReadPipe, NULL, 0, NULL, &bytesAvailable, NULL) && bytesAvailable > 0)
if (ReadFile(updater->_hReadPipe, chBuf, BUFSIZE - 1, &dwRead, NULL) && dwRead)
{
chBuf[dwRead] = '\0';
output += chBuf;
LOG_DEBUG << output;
updater->parse(output);
}
if (!GetExitCodeThread(updater->_pi.hThread, &ec) || ec != STILL_ACTIVE)
break;
}
updater->AddProgressInfo(prog_info::PROGRESS_END);
updater->DestroyHandle();
return 0;
}
示例2: read_check_update_thread
// поток, проверка наличия обновления
DWORD Updater::read_check_update_thread(LPVOID param)
{
Updater* updater = static_cast<Updater*>(param);
std::string output;
for (;;)
{
const int BUFSIZE = 1024;
char chBuf[BUFSIZE];
DWORD dwRead;
DWORD ec = 0; //exit code
DWORD bytesAvailable = 0;
while (PeekNamedPipe(updater->_hReadPipe, NULL, 0, NULL, &bytesAvailable, NULL) && bytesAvailable > 0)
if (ReadFile(updater->_hReadPipe, chBuf, BUFSIZE - 1, &dwRead, NULL) && dwRead)
{
chBuf[dwRead] = '\0';
output += chBuf;
}
if (!GetExitCodeThread(updater->_pi.hThread, &ec) || ec != STILL_ACTIVE)
break;
}
LOG_DEBUG << output;
int count_line = 0;
for (std::string::iterator it = output.begin(); it != output.end(); ++it)
{
if (*it != '\n')
continue;
std::string line = output.substr(0, std::distance(output.begin(), it));
++it;
output.erase(output.begin(), it);
it = output.begin();
if (0 != line.find("sending") &&
(line.size()-1) != line.find("/") &&
0 != line.find("deleting") &&
1 != line.find("sent") &&
0 != line.find("total size") &&
0 != line.size())
++count_line;
if (it == output.end())
break;
}
bool exist_update = count_line > 0;
updater->_status_check.get_content(); // удаляем предыдущую информацию
updater->_status_check.push_back(exist_update);
updater->DestroyHandle();
return 0;
}