本文整理匯總了C++中AfxBeginThread函數的典型用法代碼示例。如果您正苦於以下問題:C++ AfxBeginThread函數的具體用法?C++ AfxBeginThread怎麽用?C++ AfxBeginThread使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AfxBeginThread函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: KillTimer
void CFileDiffDlg::OnTimer(UINT_PTR nIDEvent)
{
if (m_bThreadRunning)
return;
if( nIDEvent == IDT_FILTER)
{
CString sFilterText;
KillTimer(IDT_FILTER);
m_cFilter.GetWindowText(sFilterText);
m_cFileList.SetRedraw(FALSE);
m_cFileList.DeleteAllItems();
Filter(sFilterText);
m_cFileList.SetRedraw(TRUE);
__super::OnTimer(nIDEvent);
}
if( nIDEvent == IDT_INPUT)
{
KillTimer(IDT_INPUT);
TRACE(_T("Input Timer\r\n"));
GitRev gitrev;
CString str;
int mask = 0;
this->m_ctrRev1Edit.GetWindowText(str);
if (!gitrev.GetCommit(str))
{
m_rev1 = gitrev;
mask |= 0x1;
}
else
{
CString msg;
msg.Format(IDS_PROC_REFINVALID, (LPCTSTR)str);
m_cFileList.ShowText(msg + _T("\n") + gitrev.GetLastErr());
}
this->m_ctrRev2Edit.GetWindowText(str);
if (!gitrev.GetCommit(str))
{
m_rev2 = gitrev;
mask |= 0x2;
}
else
{
CString msg;
msg.Format(IDS_PROC_REFINVALID, (LPCTSTR)str);
m_cFileList.ShowText(msg + _T("\n") + gitrev.GetLastErr());
}
this->SetURLLabels(mask);
if(mask == 0x3)
{
InterlockedExchange(&m_bThreadRunning, TRUE);
if (AfxBeginThread(DiffThreadEntry, this)==NULL)
{
InterlockedExchange(&m_bThreadRunning, FALSE);
CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);
}
}
}
}
示例2: LoadProgram
BOOL CALLBACK LoadProgram( HWND hWnd, int nMinProgress, int nMaxProgress )
{
int nMin = nMinProgress;
int nMax = nMaxProgress;
int nRange = nMaxProgress-nMinProgress;
CStkUIApp * pApp = AfxGetStkUIApp();
if( NULL == pApp )
return FALSE;
CStaticDoc * pStaticDoc = pApp->GetStaticDoc();
CMainFrame * pMainFrame = AfxGetMainFrame();
HINSTANCE hInstanceOld = AfxGetResourceHandle();
AfxSetResourceHandle( AfxGetInstanceHandle() );
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin, 0 );
AfxGetStockContainer().Load( &AfxGetDB(), NULL, NULL );
AfxGetDomainContainer().Load( AfxGetProfile().GetDomainFile() );
AfxGetGroupContainer().Load( AfxGetProfile().GetGroupFile() );
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*4/30, 0 );
pMainFrame->m_SearchBox.InitStocks( TRUE, TRUE, TRUE );
//pMainFrame->m_DateBox.InitDates( );
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*8/30, 0 );
// Open Simulation Strategy
if( NULL == pApp->GetFirstStrategyPosition() )
{
if( 0 == pApp->OpenLastOpenedStrategy( ) )
pApp->OpenDefaultStrategy( );
}
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*12/30, 0 );
// Show Views
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CWizardView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CWizardView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*14/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSimuView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSimuView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*16/30, 0 );
if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSListView) ) )
pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSListView), TRUE );
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*18/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CRealTimeView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CRealTimeView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*20/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CMultiSortView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CMultiSortView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*22/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CGraphView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CGraphView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*24/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CBaseView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CBaseView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*26/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CInfoView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CInfoView), TRUE );
//SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*28/30, 0 );
//if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSelectorView) ) )
// pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSelectorView), TRUE );
AfxSwitchToStaticView( RUNTIME_CLASS(CSListView) );
AfxGetProfile().SetCurrentStock( STKLIB_CODE_SZZS, FALSE );
pMainFrame->m_SearchBox.SetCurrentWindowText( );
//pMainFrame->m_DateBox.SetWindowPos(NULL,0,0,135,200,SWP_NOMOVE|SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOREDRAW);
AfxBeginThread( LoadKDataCacheMain, NULL, THREAD_PRIORITY_NORMAL);
SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMax, 0 );
AfxSetResourceHandle( hInstanceOld );
return TRUE;
}
示例3: StartThread
void CPartFileConvert::StartThread() {
if (convertPfThread==NULL)
convertPfThread=AfxBeginThread(run, NULL);
}
示例4: GetWindowText
//.........這裏部分代碼省略.........
m_cFileList.SetRedraw(true);
AddAnchor(IDC_DIFFSTATIC1, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_SWITCHLEFTRIGHT, TOP_RIGHT);
AddAnchor(IDC_FIRSTURL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_REV1BTN, TOP_RIGHT);
//AddAnchor(IDC_DIFFSTATIC2, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_SECONDURL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_REV2BTN, TOP_RIGHT);
AddAnchor(IDC_FILTER, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_REV1GROUP,TOP_LEFT,TOP_RIGHT);
AddAnchor(IDC_REV2GROUP,TOP_LEFT,TOP_RIGHT);
AddAnchor(IDC_REV1EDIT,TOP_LEFT);
AddAnchor(IDC_REV2EDIT,TOP_LEFT);
AddAnchor(IDC_LOG, TOP_RIGHT);
EnableSaveRestore(_T("FileDiffDlg"));
if(this->m_strRev1.IsEmpty())
this->m_ctrRev1Edit.SetWindowText(this->m_rev1.m_CommitHash.ToString());
else
{
bool rev1fail = false;
try
{
rev1fail = !!m_rev1.GetCommit(m_strRev1);
}
catch (const char *msg)
{
rev1fail = true;
MessageBox(_T("Could not get commit ") + m_strRev1 + _T("\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
}
if (rev1fail)
{
CString msg;
msg.Format(IDS_PROC_REFINVALID, m_strRev1);
this->m_FileListText += msg;
}
this->m_ctrRev1Edit.SetWindowText(m_strRev1);
}
if(this->m_strRev2.IsEmpty())
this->m_ctrRev2Edit.SetWindowText(this->m_rev2.m_CommitHash.ToString());
else
{
bool rev2fail = false;
try
{
rev2fail = !!m_rev2.GetCommit(m_strRev2);
}
catch (const char *msg)
{
rev2fail = true;
MessageBox(_T("Could not get commit ") + m_strRev2 + _T("\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
}
if (rev2fail)
{
CString msg;
msg.Format(IDS_PROC_REFINVALID, m_strRev2);
this->m_FileListText += msg;
}
this->m_ctrRev2Edit.SetWindowText(m_strRev2);
}
SetURLLabels();
InterlockedExchange(&m_bThreadRunning, TRUE);
if (AfxBeginThread(DiffThreadEntry, this)==NULL)
{
InterlockedExchange(&m_bThreadRunning, FALSE);
CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);
}
InterlockedExchange(&m_bLoadingRef, TRUE);
if (AfxBeginThread(LoadRefThreadEntry, this)==NULL)
{
InterlockedExchange(&m_bLoadingRef, FALSE);
CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);
}
this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFBROWSE)));
this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_LOG)));
this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFLOG)));
this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFBROWSE)));
this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_LOG)));
this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFLOG)));
// Start with focus on file list
GetDlgItem(IDC_FILELIST)->SetFocus();
if(m_rev2.m_CommitHash.IsEmpty())
m_SwitchButton.EnableWindow(FALSE);
KillTimer(IDT_INPUT);
return FALSE;
}
示例5: ProxyServerThread
//.........這裏部分代碼省略.........
case ATYP_IPV6:
DestPort=*(int *)&data[20];
SendRepToClient(ClientSock,REP_ATYP_WRONG,GetLocalIp(),0);
closesocket(ClientSock);
TRACE("ipv6 ok!\r\n");
return 0;
break;
case ATYP_DOMAIN:
index=data[4];
memcpy((void *)&DestPort,&data[index+5],2);
ZeroMemory(ip,sizeof(ip));
memcpy((void *)ip,(const void *)&data[5],index);
ip[index]='\0';
TRACE(ip);
break;
default:
SendRepToClient(ClientSock,REP_ATYP_WRONG,GetLocalIp(),0);
TRACE("default ok!\r\n");
closesocket(ClientSock);
return 0;
break;
}
sock_addr.sin_family=AF_INET;
sock_addr.sin_port=DestPort;
if(ATYP==ATYP_DOMAIN) sock_addr.sin_addr.S_un.S_addr=GetDomainIp(ip);
else sock_addr.sin_addr.S_un.S_addr=inet_addr(ip);
localsock_addr.sin_family=AF_INET;
localsock_addr.sin_port=htons(8001);
localsock_addr.sin_addr.S_un.S_addr=INADDR_ANY;
if(CMD==CMD_CONNECT){
TRACE("to connect remote ip...\r\n");
connectsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(connect(connectsock,(const sockaddr *)&sock_addr,sizeof(sock_addr))==INVALID_SOCKET){
SendRepToClient(ClientSock,REP_TTL_TIMEOUT,GetLocalIp(),0);
closesocket(ClientSock);
return 0;
}
socklen=sizeof(sock_addr);
if(getsockname(connectsock,(sockaddr *)&sock_addr,&socklen)==SOCKET_ERROR)
TRACE("get sock name err\r\n");
SendRepToClient(ClientSock,REP_SUCCESS,GetLocalIp(),ntohs(sock_addr.sin_port));
sockinfo.sourcesock=ClientSock;
sockinfo.destsock=connectsock;
TRACE("connect ok...\r\n");
AfxBeginThread(ReciveThread,(LPVOID)&sockinfo);
AfxBeginThread(SendThread,(LPVOID)&sockinfo);
//AfxBeginThread(DeailThread,(LPVOID)&sockinfo);
}
else if(CMD==CMD_BIND){
TRACE("to bind remote ip...\r\n");
listensock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(bind(listensock,(sockaddr *)&localsock_addr,sizeof(localsock_addr))==SOCKET_ERROR){
SendRepToClient(ClientSock,REP_FAILED,GetLocalIp(),0);
closesocket(ClientSock);
TRACE("to bind remote failed...\r\n");
return 0;
}
listen(listensock,10);
TRACE("to bind remote ok...\r\n");
SendRepToClient(ClientSock,REP_SUCCESS,GetLocalIp(),7895);
newsock=accept(listensock,(sockaddr *)NULL,(int *)NULL);
if(newsock==INVALID_SOCKET){
SendRepToClient(ClientSock,REP_FAILED,GetLocalIp(),0);
closesocket(ClientSock);
TRACE("to accpet remote failed...\r\n");
return 0;
}
SendRepToClient(ClientSock,REP_SUCCESS,GetLocalIp(),7895);
sockinfo.sourcesock=ClientSock;
sockinfo.destsock=newsock;
TRACE("accept ok...\r\n");
AfxBeginThread(ReciveThread,(LPVOID)&sockinfo);
AfxBeginThread(SendThread,(LPVOID)&sockinfo);
}
else if(CMD==CMD_UDP){
TRACE("to udp remote ...\r\n");
TRACE("to bind remote ip...\r\n");
listensock=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(bind(listensock,(sockaddr *)&localsock_addr,sizeof(localsock_addr))==SOCKET_ERROR){
SendRepToClient(ClientSock,REP_FAILED,GetLocalIp(),0);
closesocket(ClientSock);
TRACE("to bind remote failed...\r\n");
return 0;
}
TRACE("to bind remote ok...\r\n");
SendRepToClient(ClientSock,REP_SUCCESS,GetLocalIp(),8001);
UdpClientInfo.clientsock=ClientSock;
UdpClientInfo.remotesock=sock_addr;
UdpClientInfo.udpsock=listensock;
TRACE("udp thread ok...\r\n");
AfxBeginThread(UdpDeailThread,(LPVOID)&UdpClientInfo);
}
else{
SendRepToClient(ClientSock,REP_FAILED,GetLocalIp(),0);
closesocket(ClientSock);
return 0;
}
}
return 1;
}
示例6: MainWorkThreadFunc
//.........這裏部分代碼省略.........
{
bRet = Core.SelectQuery(
"select indexcode, mapping1, mapping2, mapping3, mapping4, mapping5, mapping6, mapping7 from skuinfo");
}
if (bRet)
{
while (row = Core.GetRecord(), row != NULL)
{
BOOL bIncludeSelf = FALSE;
if (IS_EMPTY(row[0]))
continue;
for (int i=1; i<=7; i++)
{
if (IS_EMPTY(row[i]))
continue;
SkuCodeMap.insert(std::pair<std::string,std::string>(row[0],row[i]));
if ( strcmp(row[0], row[i]) == 0 )
bIncludeSelf = TRUE;
}
if (!bIncludeSelf)
SkuCodeMap.insert(std::pair<std::string,std::string>(row[0],row[0]));
}
Core.FreeRecord();
}
// 計數器和記錄的總數,用於顯示在UI上
UINT nCount = 0;
UINT nAmount = 0;
nAmount = SkuCodeMap.size();
if (bRet)
{
std::multimap<std::string,std::string>::iterator it;
CString SQL;
for ( it = SkuCodeMap.begin() ; bRet && it != SkuCodeMap.end(); it++ )
{
//////////////////////////////////////////////////////////////////////////
// 刷新UI上的進度
//////////////////////////////////////////////////////////////////////////
nCount++;
AfxGetApp()->GetMainWnd()->PostMessageA(
WM_USER_UI_UPDATE_PROCESS,
(WPARAM) UPDATE_PROCESS,
(LPARAM) ((nAmount << 16) | nCount));
//////////////////////////////////////////////////////////////////////////
SQL.Format("select DISTINCT(`jdewh`) from `openinv_o` where `jdeskucode`='%s'", it->second.c_str());
bRet = Core.SelectQuery((LPCTSTR)SQL);
if ( !bRet )
break;
while ( row = Core.GetRecord(), row != NULL)
{
#ifdef _DEBUG
if (nCount > 50)
break;
#endif
if (IS_EMPTY(row[0]))
continue;
// 等待子工作線程資源(設置了同時工作的子線程數上限)
if (WaitForSingleObject((HANDLE)gSubThreadCount, INFINITE) != WAIT_OBJECT_0)
{
// 異常結束
bRet = FALSE;
break;
}
else
{
LPSUBWORKTHREADPARAM lpSubThreadParam = new SUBWORKTHREADPARAM;
CWinThread *pWinThread = NULL;
// 準備子工作線程的參數
lpSubThreadParam->_StartingDate = pParam->_StartingDate;
lpSubThreadParam->_FirstWeekSale = pParam->_FirstWeekSale;
strcpy_s(lpSubThreadParam->_ParentSkuCode, it->first.c_str());
strcpy_s(lpSubThreadParam->_SkuCode, it->second.c_str());
strcpy_s(lpSubThreadParam->_WareHouse, row[0]);
// 啟動一個子工作線程
pWinThread = AfxBeginThread((AFX_THREADPROC)SubWorkThreadFunc,
(LPVOID)lpSubThreadParam,
THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
pWinThread->m_bAutoDelete = TRUE;
pWinThread->ResumeThread();
}
}
Core.FreeRecord();
}
}
AfxGetApp()->GetMainWnd()->PostMessageA(
WM_USER_UI_UPDATE_PROCESS,
(WPARAM) END_PROCESS,
(LPARAM) ((nAmount << 16) | nCount));
//TODO: 需等待子線程結束?
delete pParam;
return 0;
}
示例7: AfxBeginThread
void CChatControl::GetConnect()
{
// Test for internet connection
if(!m_autPrefs->GetLanMode() && !m_InetTested)
{
CWinThread* pThread = AfxBeginThread(TestInetThread, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
AssignThreadToCPU(pThread, CPU_0);
pThread->ResumeThread();
return;
}
if(m_autPrefs->GetLanMode())
{
if(m_pPrefs->m_InternalIRC)
{
CString Host = m_pPrefs->m_InternalIRCAddr;
int pos = Host.Find(":");
if(pos != -1)
AddServer( Host.Left(Host.Find(":")), atoi(Host.Mid(Host.Find(":") + 1)));
else
AddServer(m_pPrefs->m_InternalIRCAddr, 6667);
}
return;
}
// If its for chat
if(m_pDoc->m_pViewChat)
if(m_pPrefs->m_PrefNet == "GnuDefault")
{
AddServer("irc.freenode.net", 6667);
return;
}
// Connect to random server on default network
for(int i = 0; i < m_pPrefs->m_ChatNets.size(); i++)
if(m_pPrefs->m_ChatNets[i].Name == m_pPrefs->m_PrefNet)
if(m_pPrefs->m_ChatNets[i].Servers.size())
{
int servpos = rand() % m_pPrefs->m_ChatNets[i].Servers.size() + 0;
CString Parse = m_pPrefs->m_ChatNets[i].Servers[servpos];
// Take first server from list, and move it to the back
//pPrefs->m_ChatNets[i].Servers.erase( pPrefs->m_ChatNets[i].Servers.begin() );
//pPrefs->m_ChatNets[i].Servers.push_back(Parse);
int colon = Parse.Find( _T(":") );
if(colon != -1)
{
std::vector<UINT> PortList;
CString Server = Parse.Left(colon);
CString PortString = Parse.Mid(colon + 1) + ",";
int pos = 0;
while(PortString.Find( _T(","), pos) != -1)
{
UINT port = atoi(PortString.Mid(pos, PortString.Find( _T(","), pos) - pos));
PortList.push_back(port);
pos = PortString.Find( _T(","), pos) + 1;
}
if(PortList.size())
{
int portpos = rand() % PortList.size() + 0;
AddServer(Server, PortList[portpos]);
return;
}
}
}
}
示例8: memset
void CSmartCommunicationDlg::OnButtonStart()
{
char buf[128],Module[30],msg[256];
CData mdata;
int nErrCode=0;
int FunId;
CSystemInfo SystemInfo;
list<CSocketSmart>::iterator SocketSmart;
memset(buf, 0x00,sizeof buf);
memset(msg, 0x00,sizeof msg);
memset(Module,0x00,sizeof Module);
g_CInterface.SetParentpDlg(this);
//清除顯示框中的信息
OnButtonClear();
Init();
m_BtCancel.EnableWindow(FALSE);
m_BtStart.EnableWindow(FALSE);
m_BtClear.EnableWindow(TRUE);
strcpy(msg,"前置係統開始啟動並監控所有終端設備,請稍後......");
AddString(msg);
WriteLog(msg);
//初始化第三方接口
strcpy(msg,"前置係統正在初始化第三方接口,請稍後......");
AddString(msg);
WriteLog(msg);
if( !g_bInitConnectFlag )
{
if( !g_CInterface.SMT_InterfaceInit(m_ServerIP,m_ServerPort) )
{
AddString("前置係統正在初始化第三方接口失敗,請退出前置重新啟動");
strcpy(m_ErrMsg,g_CInterface.m_szText);
goto To_SystemEnd;
}
g_bInitConnectFlag=true;
}
//前置簽到
strcpy(msg,"前置係統正在向金仕達簽到,請稍後......");
AddString(msg);
WriteLog(msg);
if( !g_CInterface.SMT_SmartFrontLogin(5000) )
{
sprintf(m_ErrMsg,"前置向金仕達簽到失敗[金仕達返回:%s]",g_CInterface.m_szText);
goto To_SystemEnd;
}
//獲取黑名單
strcpy(msg,"前置係統正在裝載黑名單,請稍後......");
AddString(msg);
WriteLog(msg);
FunId=SMT_SMARTFRONTDOWNALLBLACK;
if( !g_CInterface.SMT_GetAllInitBlackList(FunId) )
{
strcpy(m_ErrMsg,g_CInterface.m_szText);
goto To_SystemEnd;
}
//獲取補助名單
strcpy(msg,"前置係統正在裝載補助名單,請稍後......");
AddString(msg);
WriteLog(msg);
if( !g_CInterface.SMT_GetAllInitAssistantList(false,0) )
{
strcpy(m_ErrMsg,g_CInterface.m_szText);
goto To_SystemEnd;
}
//獲取設備的主參數
strcpy(msg,"前置係統正在獲取設備的主參數,請稍後......");
AddString(msg);
WriteLog(msg);
if( !GetDevicePara() )
{
strcpy(m_ErrMsg,g_CInterface.m_szText);
goto To_SystemEnd;
}
//顯示啟動的服務總數
sprintf(m_ErrMsg,"前置係統總共需要啟動%ld個鏈路服務.",g_LTcpsmart.size());
AddString(m_ErrMsg);
WriteLog(m_ErrMsg);
//啟動所有通過TCP連接的服務
for( SocketSmart=g_LTcpsmart.begin();SocketSmart!=g_LTcpsmart.end();SocketSmart++)
{
SocketSmart->SetParent(this);
SocketSmart->Start();
sprintf(m_ErrMsg,"開始準備啟動 %s 的線程......",SocketSmart->m_IpPar.cIPAddress);
AddString(m_ErrMsg);
WriteLog(m_ErrMsg);
}
g_StartFlag = 1;
//取任務線程
UINT SMT_StartQueryTaskThread( LPVOID pParam );
if(AfxBeginThread(SMT_StartQueryTaskThread, (LPVOID)this)==NULL)
{
strcpy(m_ErrMsg,"創建從數據庫中取任務的線程失敗");
goto To_SystemEnd;
}
//.........這裏部分代碼省略.........
示例9: CDLockUI
//////////////////////////////////////////////////////////////////////////
//
// Function Name: StartViewFinder
// Description: Turns the viewfinder on the camera and also ends it
// when necessary
// Parameters:
// Returns: void
// Summary:
// Author: CannonSDK
//
///////////////////////////////////////////////////////////////////////////
void CCameraConnect::StartViewfinder()
{
cdError err;
cdStgMedium VFMedium;
/* UI is locked so that information may not be changed. */
err = CDLockUI( m_hSource );
if( GETERRORID(err) != cdOK )
{
// goto camerr;
}
if( !m_fVFEnd )
{
/* The thread which displays view finder is created. */
m_fVFEnd = TRUE;
g_CpVFThread = AfxBeginThread( (AFX_THREADPROC)ViewFinderProc,
(LPVOID)this,
0,
0,
CREATE_SUSPENDED,
NULL );
/* A view finder is started. */
VFMedium.Type = cdMEMTYPE_STREAM;
err = CDStartViewfinder( m_hSource,
FILEFORMAT_BMP,
ViewFinderCallBackFun,
(cdContext)this );
if( GETERRORID(err) != cdOK )
{
//goto camerr;
}
//m_CViewFinder.SetWindowText( "Stop" );
}
else
{
/* A view finder is ended. */
err = CDTermViewfinder( m_hSource );
if( GETERRORID(err) != cdOK )
{
printf("");
//goto camerr;
}
/* A thread is ended. */
m_fVFEnd = FALSE;
g_CpVFThread->ResumeThread();
WaitForSingleObject( g_CpVFThread->m_hThread, INFINITE );
//m_CViewFinder.SetWindowText( "Start" );
//Invalidate();
//UpdateWindow();
/* The lock of UI is canceled. */
err = CDUnlockUI( m_hSource );
if( GETERRORID(err) != cdOK )
{
// goto camerr;
}
}
}
示例10: GetWindowText
//.........這裏部分代碼省略.........
{
setUrl.insert( strRssLink ) ;
}
}
else
{
setUrl.insert( strRssLink ) ;
}
//added by lost
}
break;
}
SAFE_DELETE(pLink);
}
}
else if (0 == strPrefix.CompareNoCase(_T("http"))
|| 0 == strPrefix.CompareNoCase(_T("ftp")))
{
setUrls.SetAt(strLine, NULL);
//lstUrls.AddTail(strLine);
}
}
CAddTaskDoc::RssUrlSet & setUrl = m_pDoc->GetRssUrlSet();
if (!setUrl.empty())
{
if (pThread == NULL)
{
UPDATERSS_PARAM * paramRSS = new UPDATERSS_PARAM;
paramRSS->setRssLink = setUrl;
paramRSS->thisEdit = this;
pThread = AfxBeginThread( ThreadUpdateRSS, paramRSS );//線程獲取FEED信息
}
}
//從獲取到的FEED集合中得到所有文件hash
set<CFileHashKey> setKeysInLastFeed;
if ( !setRssUpdatefeed.empty() )
{
set<CRssFeed*>::iterator itRss;
for ( itRss = setRssUpdatefeed.begin(); setRssUpdatefeed.end() != itRss; itRss++ )
{
CRssFeed* pFeed = *itRss;
CED2KLink *pLinkRss = NULL;
for ( CRssFeed::ItemIterator it = pFeed->GetItemIterBegin(); it != pFeed->GetItemIterEnd(); ++it )
{
CRssFeed::Item & item = it->second;
try
{
pLinkRss = NULL;
pLinkRss = CED2KLink::CreateLinkFromUrl(item.m_strEnclosure);
}
catch (...)
{
SAFE_DELETE(pLinkRss);
}
if (NULL != pLinkRss)
{
switch ( pLinkRss->GetKind() )
{
case CED2KLink::kFile:
示例11: MoveWindow
//.........這裏部分代碼省略.........
//m_ctrlAnimate.Open(IDR_HTTPDOWNLOAD_ANIMATION);
m_ctrlAnimate.ShowWindow(SW_HIDE);
m_static.SetMyText("遊戲下載");
m_static.MoveWindow(10,40,80,80);
m_listbox.MoveWindow(12,58,410,100);
m_listbox.InitListCtrl(RGB(194,212,234),RGB(0,0,0),RGB(249,175,40),RGB(0,0,0),"");
m_listbox.setProcessPos(2);
m_listbox.SetProcessImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP6),MAKEINTRESOURCE(IDB_BITMAP7));
m_listbox.InsertColumn(0,"文件名",LVCFMT_CENTER,130);
m_listbox.InsertColumn(1,"大小(KB)",LVCFMT_CENTER,60);
m_listbox.InsertColumn(2,"進度",LVCFMT_CENTER,170);
m_listbox.InsertColumn(3,"速度",LVCFMT_CENTER,50);
m_listbox.InitListHeader(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1),MAKEINTRESOURCE(IDB_BITMAP1),RGB(255,255,255),RGB(255,255,255),1);
m_listbox.SetTimer(100,10,NULL);
m_exit.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP5);
m_exit.SetPosition(CPoint(410,10));
m_cancel.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP4);
m_cancel.SetPosition(CPoint(360,175));
//Validate the URL
ASSERT(m_sURLToDownload.GetLength()); //Did you forget to specify the file to download
if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort))
{
//Try sticking "http://" before it
m_sURLToDownload = CString("http://") + m_sURLToDownload;
if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort))
{
TRACE(_T("Failed to parse the URL: %s\n"), m_sURLToDownload);
EndDialog(IDCANCEL);
return TRUE;
}
}
//Check to see if the file we are downloading to exists and if
//it does, then ask the user if they were it overwritten
CFileStatus fs;
ASSERT(m_sFileToDownloadInto.GetLength());
if (CFile::GetStatus(m_sFileToDownloadInto, fs))
{/*
CString sMsg;
AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_OK_TO_OVERWRITE, m_sFileToDownloadInto);
if (AfxMessageBox(sMsg, MB_YESNO) != IDYES)
{
TRACE(_T("Failed to confirm file overwrite, download aborted\n"));
EndDialog(IDCANCEL);
return TRUE;
}*/
}
//Try and open the file we will download into
if (!m_FileToWrite.Open(m_sFileToDownloadInto, CFile::modeCreate | CFile::modeWrite | CFile::shareDenyWrite))
{
TRACE(_T("Failed to open the file to download into, Error:%d\n"), GetLastError());
CString sError;
sError.Format(_T("%d"), ::GetLastError());
CString sMsg;
AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_FAIL_FILE_OPEN, sError);
//AFCMessageBox(sMsg);
DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"係統提示",false,sMsg);
EndDialog(IDCANCEL);
return TRUE;
}
//Pull out just the filename component
int nSlash = m_sObject.ReverseFind(_T('/'));
if (nSlash == -1)
nSlash = m_sObject.ReverseFind(_T('\\'));
if (nSlash != -1 && m_sObject.GetLength() > 1)
m_sFilename = m_sObject.Right(m_sObject.GetLength() - nSlash - 1);
else
m_sFilename = m_sObject;
m_listbox.InsertItem(0,m_sFilename.GetBuffer());
//Set the file status text
CString sFileStatus;
ASSERT(m_sObject.GetLength());
ASSERT(m_sServer.GetLength());
AfxFormatString2(sFileStatus, IDS_HTTPDOWNLOAD_FILESTATUS, m_sFilename, m_sServer);
m_ctrlFileStatus.SetWindowText(sFileStatus);
//Spin off the background thread which will do the actual downloading
m_pThread = AfxBeginThread(_DownloadThread, this, THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED);
if (m_pThread == NULL)
{
TRACE(_T("Failed to create download thread, dialog is aborting\n"));
EndDialog(IDCANCEL);
return TRUE;
}
m_pThread->m_bAutoDelete = FALSE;
m_pThread->ResumeThread();
return TRUE;
}
示例12: AfxBeginThread
void CFileAssoc::CheckIconsAssoc(const CMediaFormats& mf)
{
AfxBeginThread(RunCheckIconsAssocThread, (LPVOID)&mf);
}
示例13: if
void CTTToeView::OnTimer(UINT nFlags)
{
if(nFlags == TMR_FIELD_ID){
field->updateCells();
}
else if (nFlags == TMR_MENU_ID){
menu->timerTicked();
menu->displayUpdated();
}
else if(nFlags == TMR_MAIN_ID){
if(gameStatus != -2){
if(moveQueued){
moveMade = false;
aiThinking = true;
aiThread = AfxBeginThread(makeAIMove, &vicCombStartEnd);
moveQueued = false;
}
if(moveMade){
getMainFrame()->setStPlayersMove();
getMainFrame()->resetAIPerc();
getMainFrame()->setMoveNum(field->getMovesMade());
moveMade = false;
aiThinking = false;
if(gameStatus != -1){
if(aiMove.getIsValid()){
field->aIPlayed(aiMove);
}
vicAnimFirstTime = true;
OnMouseMove(0,CPoint(0,0));
bool prevValue = settings.showtrack;
settings.showtrack = true;
if(gameStatus == RateField::ST_AI_WON){
gameStatus = -2;
getMainFrame()->setAIScr(++aiVictoryNumber);
MessageBox(L"Sorry, you have lost...");
}
else if(gameStatus == RateField::ST_PLAYER_WON){
gameStatus = -2;
getMainFrame()->setPlayerScr(++playerVicNumber);
MessageBox(L"Congratulations, you have won!");
}
else{
gameStatus = -1;
getMainFrame()->setDrawScr(++drawNumber);
MessageBox(L"Draw!");
}
settings.showtrack = prevValue;
gameStatus = -1;
field->resetCellModes();
getMainFrame()->setMoveNum(field->getMovesMade());
field->display(false,false,false,false);
}
else{
lastMove = aiMove;
field->aIPlayed(lastMove);
}
}
}
}
else if(nFlags == TMR_MENU_ACT_SEQ_ID){
processMenuActions();
KillTimer(TMR_MENU_ACT_SEQ_ID);
}
else if(nFlags == TMR_WINNING_COMB_ID){
if(gameStatus == -2){
animateWinningCombination();
}
}
else if(nFlags == TMR_STATUS_BAR_ID){
if(aiThinking){
getMainFrame()->updateStAIThinking();
getMainFrame()->setAIPerc(field->getAIPercent());
}
}
else if(nFlags == TMR_TEST_ID){
if(cnt == 0){
}
else{
testProperty = false;
char* a = new char[20];
_itoa(cnt, a, 10);
cnt = 0;
CString str(a);
MessageBox(str);
//.........這裏部分代碼省略.........
示例14: ExtendFrameIntoClientArea
//.........這裏部分代碼省略.........
SetDlgItemText(IDC_BUGTRAQBUTTON, temp == 0 ? L"" : temp);
GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(TRUE);
GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_SHOW);
}
}
GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
}
if (m_ProjectProperties.sMessage.IsEmpty())
{
GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
}
else
{
GetDlgItem(IDC_BUGID)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_SHOW);
if (!m_ProjectProperties.sLabel.IsEmpty())
SetDlgItemText(IDC_BUGIDLABEL, m_ProjectProperties.sLabel);
GetDlgItem(IDC_BUGID)->SetFocus();
}
if (!m_sLogMessage.IsEmpty())
m_cLogMessage.SetText(m_sLogMessage);
else
m_cLogMessage.SetText(m_ProjectProperties.GetLogMsgTemplate(PROJECTPROPNAME_LOGTEMPLATEBRANCH));
OnEnChangeLogmessage();
m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKALL);
m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKNONE);
// line up all controls and adjust their sizes.
#define LINKSPACING 9
RECT rc = AdjustControlSize(IDC_SELECTLABEL);
rc.right -= 15; // AdjustControlSize() adds 20 pixels for the checkbox/radio button bitmap, but this is a label...
rc = AdjustStaticSize(IDC_CHECKALL, rc, LINKSPACING);
rc = AdjustStaticSize(IDC_CHECKNONE, rc, LINKSPACING);
CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_TEXT);
CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_HELP, CString(MAKEINTRESOURCE(IDS_INPUT_ENTERLOG)));
CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_INVISIBLE)));
CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKALL)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK);
CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKNONE)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK);
CAppUtils::SetAccProperty(m_URLCombo.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_TOURLLABEL)));
CAppUtils::SetAccProperty(GetDlgItem(IDC_FROMURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_COPYSTARTLABEL)));
CAppUtils::SetAccProperty(GetDlgItem(IDC_DESTURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_DESTLABEL)));
AddAnchor(IDC_REPOGROUP, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_COPYSTARTLABEL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_FROMURL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_TOURLLABEL, TOP_LEFT);
AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_BROWSE, TOP_RIGHT);
AddAnchor(IDC_DESTLABEL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_DESTURL, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_MSGGROUP, TOP_LEFT, MIDDLE_RIGHT);
AddAnchor(IDC_HISTORY, TOP_LEFT);
AddAnchor(IDC_BUGTRAQBUTTON, TOP_LEFT);
AddAnchor(IDC_BUGIDLABEL, TOP_RIGHT);
AddAnchor(IDC_BUGID, TOP_RIGHT);
AddAnchor(IDC_INVISIBLE, TOP_RIGHT);
AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, MIDDLE_RIGHT);
AddAnchor(IDC_FROMGROUP, MIDDLE_LEFT, MIDDLE_RIGHT);
AddAnchor(IDC_COPYHEAD, MIDDLE_LEFT);
AddAnchor(IDC_COPYREV, MIDDLE_LEFT);
AddAnchor(IDC_COPYREVTEXT, MIDDLE_RIGHT);
AddAnchor(IDC_BROWSEFROM, MIDDLE_RIGHT);
AddAnchor(IDC_COPYWC, MIDDLE_LEFT);
AddAnchor(IDC_EXTGROUP, MIDDLE_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_SELECTLABEL, MIDDLE_LEFT);
AddAnchor(IDC_CHECKALL, MIDDLE_LEFT);
AddAnchor(IDC_CHECKNONE, MIDDLE_LEFT);
AddAnchor(IDC_EXTERNALSLIST, MIDDLE_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_DOSWITCH, BOTTOM_LEFT);
AddAnchor(IDC_MAKEPARENTS, BOTTOM_LEFT);
AddAnchor(IDOK, BOTTOM_RIGHT);
AddAnchor(IDCANCEL, BOTTOM_RIGHT);
AddAnchor(IDHELP, BOTTOM_RIGHT);
if ((m_pParentWnd==NULL)&&(GetExplorerHWND()))
CenterWindow(CWnd::FromHandle(GetExplorerHWND()));
EnableSaveRestore(L"CopyDlg");
m_bSettingChanged = false;
if (!m_path.IsUrl())
{
// start a thread to obtain the highest revision number of the working copy
// without blocking the dialog
if ((m_pThread = AfxBeginThread(FindRevThreadEntry, this))==NULL)
{
OnCantStartThread();
}
}
return TRUE;
}
示例15: ZeroMemory
BOOL CInstall::InitInstance()
{
// Log
CLog::Instance()->Log(_T("CInstall::InitInstance()"));
// Set parent to NULL
m_pParent = NULL;
// We are not started yet
m_bStarted = false;
// Reserve memory for buffer
m_szFilename = (TCHAR *)malloc(sizeof(TCHAR) * 500);
ZeroMemory(m_szFilename, sizeof(TCHAR) * 500);
// Start install files thread
m_pInstallFiles = (CInstallFiles *)AfxBeginThread(RUNTIME_CLASS(CInstallFiles),
THREAD_PRIORITY_NORMAL,
0,
0,
NULL);
// Start install ini thread
m_pInstallIni = (CInstallIni *)AfxBeginThread(RUNTIME_CLASS(CInstallIni),
THREAD_PRIORITY_NORMAL,
0,
0,
NULL);
// Start install registry thread
m_pInstallRegistry = (CInstallRegistry *)AfxBeginThread(RUNTIME_CLASS(CInstallRegistry),
THREAD_PRIORITY_NORMAL,
0,
0,
NULL);
// Init singleton classes
m_pFunctions = CFunctions::Instance();
m_pSettings = CSettings::Instance();
m_pUpdateInfo = CUpdateInfo::Instance();
m_pLanguage = CLanguage::Instance();
m_pPath = CPath::Instance();
// Extract UpdaterCopy.exe from this executable
if (m_pUpdateInfo->GetSelfUpdate())
ExtractUpdaterCopy();
// Set parent
m_pInstallFiles->PostThreadMessage(WMU_SETPARENT, (WPARAM)this, 0);
m_pInstallIni->PostThreadMessage(WMU_SETPARENT, (WPARAM)this, 0);
m_pInstallRegistry->PostThreadMessage(WMU_SETPARENT, (WPARAM)this, 0);
// Suspend all threads
/*m_pInstallFiles->SuspendThread();
m_pInstallIni->SuspendThread();
m_pInstallRegistry->SuspendThread();*/
// Set some default values
m_iPreviousActionsPerformed = 0;
m_iTotalActionsPerformed = 0;
return TRUE;
}