本文整理汇总了C++中ProcessMessages函数的典型用法代码示例。如果您正苦于以下问题:C++ ProcessMessages函数的具体用法?C++ ProcessMessages怎么用?C++ ProcessMessages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessMessages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOpenADCSaveFile
// 将ADC数据保存到文件中
void CADCDataSaveToFileThread::OnSaveADCToFile(unsigned int uiADCSaveDataNum)
{
CString strOutput = "";
CString strTemp = "";
if(m_bOpenADCSaveFile == FALSE)
{
OnOpenADCSaveFile();
}
// 输出各仪器采样数据
for (unsigned int i=0; i<uiADCSaveDataNum; i++)
{
ProcessMessages();
for (int j=0; j<GraphViewNum; j++)
{
ProcessMessages();
strTemp.Format(_T("%2.*lf\t"),DecimalPlaces, m_dADCSaveToFileProcBuf[j][i]);
strOutput += strTemp;
}
strOutput += "\r\n";
}
for (int i=0; i<GraphViewNum; i++)
{
memset(m_dADCSaveToFileProcBuf[i], 0, uiADCSaveDataNum);
}
fprintf(m_pFileSave,"%s", strOutput);
m_uiADCDataToSaveNum += uiADCSaveDataNum;
if (m_uiADCDataToSaveNum == m_uiADCFileLength)
{
m_uiADCDataToSaveNum = 0;
OnCloseADCSaveFile();
}
}
示例2: ProcessMessages
// 关闭采样后保存剩余数据
void CADCDataRecThread::OnSaveRemainADCData(unsigned int uiADCDataNeedToSave)
{
unsigned int uiDataLength = 0;
CString strOutput = "";
CString strTemp ="";
if (m_pFileSave == NULL)
{
return;
}
for (unsigned int i=0; i<uiADCDataNeedToSave; i++)
{
ProcessMessages();
for (int j=0; j<GraphViewNum; j++)
{
ProcessMessages();
if (m_pSelectObject[j] == 1)
{
if (m_pSelectObjectNoise[j] == 0)
{
uiDataLength = m_dADCSave[j].size();
if (uiDataLength == 0 )
{
strOutput += "\t\t";
continue;
}
if (uiDataLength > i)
{
strTemp.Format("%2.*lf\t",DecimalPlaces, m_dADCSave[j][i]);
strOutput += strTemp;
}
else
{
strOutput += "\t\t";
}
}
else
{
strOutput += "\t\t";
}
}
else
{
strOutput += "\t\t";
}
}
strOutput += "\r\n";
}
fprintf(m_pFileSave,"%s", strOutput);
// 清空接收缓冲区
for (unsigned int i=0; i<GraphViewNum; i++)
{
ProcessMessages();
m_dADCSave[i].clear();
}
OnCloseADCSaveFile();
}
示例3: _T
// 创建并打开ADC保存数据文件
void CADCDataRecThread::OnOpenADCSaveFile(void)
{
m_uiADCSaveFileNum++;
CString strFileName = _T("");
CString strOutput = _T("");
CString strTemp = _T("");
errno_t err;
CString str = _T("");
SYSTEMTIME sysTime;
unsigned int uiADCDataFrameCount = 0;
strFileName += m_csSaveFilePath;
strTemp.Format(_T("\\%d.text"), m_uiADCSaveFileNum);
strFileName += strTemp;
// 将ADC采样数据保存成ANSI格式的文件
if((err = fopen_s(&m_pFileSave,strFileName,"w+"))!=NULL)
{
AfxMessageBox(_T("ADC数据存储文件创建失败!"));
return;
}
GetLocalTime(&sysTime);
for (int i=0; i<InstrumentNum; i++)
{
ProcessMessages();
if (m_pSelectObject[i] == 1)
{
if (m_pSelectObjectNoise[i] == 0)
{
uiADCDataFrameCount = m_uiADCDataFrameCount[i];
break;
}
}
}
str.Format(_T("%04d年%02d月%02d日%02d:%02d:%02d:%03d 由第%d个数据包开始记录ADC采样数据:\r\n\r\n"), sysTime.wYear,sysTime.wMonth,sysTime.wDay,
sysTime.wHour,sysTime.wMinute,sysTime.wSecond,sysTime.wMilliseconds, uiADCDataFrameCount);
strOutput += str;
// 输出仪器标签
for (int i=0; i<InstrumentNum; i++)
{
ProcessMessages();
strTemp.Format(_T("%s\t\t"),m_cSelectObjectName[i]);
strOutput += strTemp;
}
strOutput += _T("\r\n");
fprintf(m_pFileSave, _T("%s"), strOutput);
m_bOpenADCSaveFile = TRUE;
}
示例4: ProcessMessages
// 被选择仪器的ADC数据个数的最小值
unsigned int CADCDataSaveToFile::OnADCRecDataMinNum(unsigned int* upADCDataNum, int* pSelectObject,
int* pSelectObjectNoise)
{
unsigned int uiMinSize = 10000;
bool bSelect = false;
for (int i=0; i<InstrumentNum; i++)
{
ProcessMessages();
if (pSelectObject[i] == 1)
{
if (pSelectObjectNoise[i] == 0)
{
if (uiMinSize > upADCDataNum[i])
{
uiMinSize = upADCDataNum[i];
bSelect = true;
}
}
}
}
if (bSelect == false)
{
uiMinSize = 0;
}
return uiMinSize;
}
示例5: while
// ADC数据需要重新发送帧对应的最小个数
unsigned int CADCDataRecThread::OnADCRetransimissionMinNb(unsigned int uiInstrumentNb)
{
unsigned int uimin = 0; // 最小值
POSITION pos = m_oADCLostMap[uiInstrumentNb].GetStartPosition(); // 得到索引表起始位置
unsigned int uiKey; // 索引键
unsigned int uiCount = 0; // 计数
while(NULL != pos)
{
ProcessMessages();
m_structADC ADCStructTemp;
m_oADCLostMap[uiInstrumentNb].GetNextAssoc(pos, uiKey, ADCStructTemp); // 得到仪器对象
uiCount++;
if (uiCount == 1)
{
uimin = ADCStructTemp.uiDataCount;
}
else
{
if (uimin > ADCStructTemp.uiDataCount)
{
uimin = ADCStructTemp.uiDataCount;
}
}
}
return uimin;
}
示例6: while
// 删除所有仪器
//************************************
// Method: DeleteAllInstrument
// FullName: CInstrumentList::DeleteAllInstrument
// Access: public
// Returns: void
// Qualifier:
// Parameter: void
//************************************
void CInstrumentList::DeleteAllInstrument(void)
{
CInstrument* pInstrument = NULL; // 仪器对象指针
POSITION pos = NULL; // 位置
unsigned int uiKey = 0; // 索引键
unsigned int icount = m_oInstrumentMap.GetCount();
if (icount == 0)
{
return;
}
pos = m_oInstrumentMap.GetStartPosition(); // 得到索引表起始位置
while(NULL != pos)
{
ProcessMessages();
pInstrument = NULL;
m_oInstrumentMap.GetNextAssoc(pos, uiKey, pInstrument); // 得到仪器对象
if(NULL != pInstrument)
{
// 显示设备断开连接的图标
OnShowDisconnectedIcon(pInstrument->m_uiIPAddress);
// 将仪器从索引表中删除
DeleteInstrumentFromMap(uiKey);
// 重置仪器
pInstrument->OnReset();
// 仪器加在空闲仪器队列尾部
m_olsInstrumentFree.AddTail(pInstrument);
m_uiCountFree++;
}
}
}
示例7: SortOutProcessedMessages
//--------------------------------------------------------------------------------------
// Updates the manoeuvre. This mostly consists of processing any messages received from
// the participating entities and reacting accordingly. This can include the sending
// out of follow-up orders for entities that have completed a stage of the manoeuvre. Eventually
// the function should also check whether the goal of the manoeuvre has been achieved in
// order to initiate termination.
// Param1: The time passed since the last update.
// Returns a behaviour status representing the state of the manoeuvre.
//--------------------------------------------------------------------------------------
BehaviourStatus GuardedFlagCapture::Update(float deltaTime)
{
// Keep track of who has reached the target and let those defend until all have arrived
SortOutProcessedMessages();
ProcessMessages();
m_timer += deltaTime;
if(m_updateMovementTargetsInterval != 0.0f && m_timer >= m_updateMovementTargetsInterval)
{
UpdateMovementTargets();
m_timer = 0.0f;
}
if(!IsActive() || HasFailed() || (GetNumberOfParticipants() < GetMinNumberOfParticipants()))
{
// The manoeuvre will fail if something failed during the initiation or if it wasn't
// initiated at all.
return StatusFailure;
}else if(HasSucceeded())
{
return StatusSuccess;
}
return StatusRunning;
}
示例8: Run
/**
* Nachrichtenschleife.
*
* @author FloSoft
*/
int LobbyServer::Run(void)
{
// Clients testen (auf timeout usw)
if(!CheckClientTimeouts())
return 2;
// neue Clients verbinden
if(!CheckForNewClients())
return 3;
// Daten weiterleiten
if(!ProcessMessages())
return 4;
// ggf. stoppen
if(stop == true)
return 100;
#ifdef _WIN32
Sleep(20);
#else
usleep(20);
#endif
return 0;
}
示例9: OnUserPreNotice
ModResult OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
return ProcessMessages(user, static_cast<Channel*>(dest));
return MOD_RES_PASSTHRU;
}
示例10: _T
bool PerigeeMove::InitIt()
{
// on Windows Vista, verify we have permissions to do this, and prompt to elevate otherwise
if (!m_options.skip_inventory &&
VistaHelper::IsVistaOrNewer() && !VistaHelper::IsAdmin())
{
CString prompt;
prompt.LoadString( IDS_PREPARING_TO_MOVE_FILES );
m_progress.SetSourceDest(prompt, _T(""));
int count = 0;
for(file_list::iterator it = m_files.begin(); it != m_files.end(); ++it)
{
if (!VistaHelper::CheckAccess(it->source, GENERIC_READ | DELETE, m_token))
{
CString message;
message.Format(IDS_ELEVATION_REQUIRED_TO_MOVE_FILE, it->source);
DoElevatePrompt(message);
if (m_cancel)
return false;
}
if (0 == (++count & 0x3f))
{
ProcessMessages();
m_cancel = m_cancel || m_progress.m_CancelRequest;
}
}
}
return true;
}
示例11: while
// 设备根据首包时刻排序
void CInstrumentList::SetInstrumentLocation(CInstrument* pInstrumentAdd)
{
CInstrument* pInstrument = NULL; // 仪器对象指针
POSITION pos = NULL; // 位置
unsigned int uiKey; // 索引键
pos = m_oInstrumentMap.GetStartPosition(); // 得到索引表起始位置
while(NULL != pos)
{
ProcessMessages();
pInstrument = NULL;
m_oInstrumentMap.GetNextAssoc(pos, uiKey, pInstrument); // 得到仪器对象
if(NULL != pInstrument)
{
if (pInstrumentAdd->m_uiHeadFrameTime > pInstrument->m_uiHeadFrameTime)
{
pInstrumentAdd->m_uiLocation++;
}
else
{
pInstrument->m_uiLocation++;
// 按照首包时刻位置设置仪器IP地址
pInstrument->m_uiIPAddress = 71 + (pInstrument->m_uiLocation)*10;
}
}
}
// 按照首包时刻位置设置新加入仪器的IP地址
pInstrumentAdd->m_uiIPAddress = 71 + (pInstrumentAdd->m_uiLocation)*10;
pInstrument = NULL;
delete pInstrument;
}
示例12: while
int
RoutingNode::RequestNeighborConnectionInfo()
{
neighborsIter it = neighbors.begin();
while (it != neighbors.end())
{
char buffer[512];
bzero(buffer,512);
sprintf(buffer, "@%d~%d~%d", myID, RoutingMessage::REQCONINFO, it->first);
SendMessage(server, buffer);
bzero(buffer,512);
#if logging > 1
cout << "Waiting for connection ACK of " << it->first << "...\n";
#endif
//wait for ack
//replace with message-type parser at some point
while (buffer[6] != '1' && buffer[7] != '7')
{
bzero(buffer,512);
int n = recvfrom(mySocket,buffer,512,0,(struct sockaddr *)&neighbor, &sockLen);
}
messages.clear();
parser.ParseMessage(buffer, fromNode, messages);
ProcessMessages();
it++;
}
}
示例13: ProcessMessages
// 计算出最大的待处理数据个数
unsigned int CADCDataSaveToFileThread::OnCalMaxNeedToSaveDataNum(void)
{
unsigned int uiMax = 0;
unsigned int uiNum = 0;
unsigned int uiClearZeroNum = 0;
for (unsigned int i=0; i<GraphViewNum; i++)
{
ProcessMessages();
if (m_pSelectObject[i] == 1)
{
if (m_pSelectObjectNoise[i] == 0)
{
uiNum = m_uiADCFrameSaveToFileProcNum[i] * ADCFrameNumNeedToSave + m_uiADCFrameRemain[i];
uiClearZeroNum = ADCDataSaveToFileBufSize - uiNum * ReceiveDataSize;
if(uiClearZeroNum > 0)
{
memset(&m_dADCSaveToFileProcBuf[i][ADCDataSaveToFileBufSize - uiClearZeroNum], 0, uiClearZeroNum);
}
if (uiNum > uiMax)
{
uiMax = uiNum;
}
}
}
}
for (int i=0; i<GraphViewNum; i++)
{
m_uiADCFrameSaved[i] += uiMax;
}
uiMax = uiMax * ReceiveDataSize;
return uiMax;
}
示例14: bzero
int
RoutingNode::GetMyID()
{
#if logging > 1
cout << "Getting Id...\n";
#endif
int n;
char buffer[512];
bzero(buffer,512);
unsigned int length = sizeof(struct sockaddr_in);
struct sockaddr_in from;
n = sendto(mySocket,"!", strlen("!"),0,(const struct sockaddr *)&server,length);
if (n < 0)
perror("Sendto");
n = recvfrom(mySocket,buffer,512,0,(struct sockaddr *)&from, &length);
if (n < 0)
perror("recvfrom");
parser.ParseMessage(buffer, fromNode, messages);
ProcessMessages();
}
示例15: _T
void CTabADCDataShow::OnTimer(UINT_PTR nIDEvent)
{
// TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ
if (nIDEvent == TabADCDataShowADCTimerNb)
{
CString str = _T("");
CString strshow = _T("");
double dbTemp = 0.0;
if (m_pADCDataShow != NULL)
{
for (int i=1; i<=InstrumentNum; i++)
{
ProcessMessages();
m_Sec_ADCDataShow.Lock();
dbTemp = m_pADCDataShow[i-1];
m_Sec_ADCDataShow.Unlock();
str.Format(_T("ADC%d = %2.*lf"), i, DecimalPlaces, dbTemp);
strshow += str;
if(i % ADCDataShowPerLineNum == 0)
{
strshow += _T("\r\n");
}
else
{
strshow += _T("\t");
}
}
}
GetDlgItem(IDC_EDIT_ADCDATA)->SetWindowText(strshow);
}
CDialog::OnTimer(nIDEvent);
}