这篇教程C++ AfxGetThreadState函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AfxGetThreadState函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxGetThreadState函数的具体用法?C++ AfxGetThreadState怎么用?C++ AfxGetThreadState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AfxGetThreadState函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: lstrcpyn//--------------------------------------------------------------------------------------------------------------//BOOL CFrmMain::PreCreateWindow(CREATESTRUCT& cs){ if (FALSE == CFrameWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; lstrcpyn(AfxGetThreadState()->m_szTempClassName, c_szSingleInstanceId, sizeof(AfxGetThreadState()->m_szTempClassName) / sizeof(TCHAR)); cs.lpszClass = AfxGetThreadState()->m_szTempClassName; WNDCLASS wndcls = {0}; HINSTANCE hInst = NULL; hInst = AfxGetInstanceHandle(); if (FALSE == ::GetClassInfo(hInst, cs.lpszClass, &wndcls)) { wndcls.style = 0; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = NULL; wndcls.hbrBackground = NULL; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = cs.lpszClass; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } else { ASSERT(wndcls.style == 0); return TRUE; } return TRUE;}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:36,
示例2: while//延时函数,测试环境是一个对话框程序//如果超时中止,返回真,否则假。bool zstringEx::z_wait_message_until_true(bool *Global_x_false,long ms){//注意,本函数可能让程序无法退出,所以结束程序时,要先结束本函数//在启动本等待函数时,第一个参数为假,当它为真时,等待就结束了//ms=0,则上一个等待是永远,否则就是等待的毫秒值,值一到就不再等了,哪怕第一个参数还是假 bool *is_loop_user_stop=Global_x_false; long m_start=clock();long m_end; long kms=ms;bool timeout_flag=false; _AFX_THREAD_STATE *pState; //定义指针 while(true) //这是一个死循环 { pState= AfxGetThreadState(); //得到线程状态参数的指针 if(pState==NULL)break; if(::PeekMessage(&(pState->m_msgCur),NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&(pState->m_msgCur)); //执行线程消息,如使按钮能响应 ::DispatchMessage(&(pState->m_msgCur)); } if(is_loop_user_stop!=NULL){if(*is_loop_user_stop==true)break;} //判断 用户是否要求停止,如果要,就断了死循环 if(kms!=0){m_end=clock();if(m_end-m_start>=kms){timeout_flag=true;break;}} //判断是否超时 Sleep(1); //减少CPU的占用,这个参数是消息响应速度,越大响应效果越差,越小CPU占用越大 } return timeout_flag;}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:30,
示例3: AfxOleTermvoid AFXAPI AfxOleTerm(BOOL bJustRevoke){ // release clipboard ownership COleDataSource::FlushClipboard(); // revoke all class factories COleObjectFactory::RevokeAll();#ifndef _AFX_NO_OCC_SUPPORT AfxOleUnlockAllControls();#endif if (!bJustRevoke) { CWinThread* pThread = AfxGetThread(); if (pThread != NULL) { // destroy message filter (may be derived class) delete pThread->m_pMessageFilter; pThread->m_pMessageFilter = NULL; } // terminate OLE last _AFX_THREAD_STATE* pState = AfxGetThreadState(); // -1 is special case, so need to compare against TRUE if (pState->m_bNeedTerm == TRUE) { CoFreeUnusedLibraries(); ::OleUninitialize(); pState->m_bNeedTerm = FALSE; } }}
开发者ID:Rupan,项目名称:winscp,代码行数:33,
示例4: GetActiveWindowBOOL COFSNcDlg::OnNcActivate(BOOL bActive){ /// Обработка OnNcActivate и Запоминания состояния для перерисовки if (m_nFlags & WF_STAYACTIVE) bActive = TRUE; if (!IsWindowEnabled()) bActive = FALSE; if (bActive==m_bActive) return TRUE; CWnd* pActiveWnd = GetActiveWindow(); if (pActiveWnd&&pActiveWnd!=this) { pActiveWnd->SendMessage(WM_NCACTIVATE,bActive); pActiveWnd->SendMessage(WM_NCPAINT); } // Turn WS_VISIBLE off before calling DefWindowProc, // so DefWindowProc won't paint and thereby cause flicker. // DWORD dwStyle = GetStyle(); if (dwStyle & WS_VISIBLE) ::SetWindowLong(*this, GWL_STYLE, (dwStyle & ~ WS_VISIBLE)); MSG& msg = AfxGetThreadState()->m_lastSentMsg; msg.wParam = bActive; Default(); if (dwStyle & WS_VISIBLE) ::SetWindowLong(*this, GWL_STYLE, dwStyle); // At this point, nothing has happened (since WS_VISIBLE was off). // Now it's time to paint. // m_bActive = bActive; // update state SendMessage(WM_NCPAINT); // paint non-client area (frame too) return TRUE; // done OK}
开发者ID:0anion0,项目名称:IBN,代码行数:34,
示例5: AfxGetThreadStateint CWinThread::RunLoop() { bool bIdle = true; LONG lIdleCount = 0; _AFX_THREAD_STATE* pState = AfxGetThreadState(); while (true) {#if UCFG_GUI while (bIdle && !::PeekMessage(&(pState->m_msgCur), 0, 0, 0, PM_NOREMOVE)) bIdle = OnIdle(lIdleCount++);#endif do { //#ifndef NO_GUI //!!! if (!PumpMessage()) return ExitInstance(); //#endif if (IsIdleMessage(pState->m_msgCur)) { bIdle = true; lIdleCount = 0; } } while (::PeekMessage(&(pState->m_msgCur), NULL, NULL, NULL, PM_NOREMOVE)); }}
开发者ID:sirmax1,项目名称:coin,代码行数:26,
示例6: ASSERTvoid COXImageListBox::PreSubclassWindow() { // TODO: Add your specialized code here and/or call the base class DWORD dwStyle=GetStyle(); // make sure LBS_OWNERDRAWFIXED and LBS_MULTICOLUMN styles are specified ASSERT(dwStyle&LBS_OWNERDRAWFIXED); ASSERT(dwStyle&LBS_MULTICOLUMN); // make sure LBS_OWNERDRAWVARIABLE and LBS_MULTIPLESEL styles are not specified ASSERT(!(dwStyle&(LBS_OWNERDRAWVARIABLE|LBS_MULTIPLESEL))); // make sure the control is empty ASSERT(GetCount()==0); _AFX_THREAD_STATE* pThreadState=AfxGetThreadState(); // hook not already in progress if(pThreadState->m_pWndInit==NULL) { if(!InitializeImageListBox()) { TRACE(_T("COXImageListBox::PreSubclassWindow: failed to initialize the control/n")); } } CListBox::PreSubclassWindow();}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:26,
示例7: ASSERT_VALIDvoid COXHistoryCombo::PreSubclassWindow() { ASSERT_VALID(this); // ... Attached window must be valid ASSERT(m_hWnd != NULL); ASSERT(::IsWindow(m_hWnd)); _AFX_THREAD_STATE* pThreadState=AfxGetThreadState(); // hook not already in progress if(pThreadState->m_pWndInit==NULL) { if(GetParent() != NULL) { // Initialize this control InitCombo(); } } // If GetParent() == NULL, this control is being created through Create() // and it is still to ealy to initialize, this will be done in OnCreate CComboBox::PreSubclassWindow(); ASSERT_VALID(this);}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:26,
示例8: ProcessGUIMessages virtual void ProcessGUIMessages() { // Adapted from MFC's CWinThread::Run() (thrdcore.cpp). _AFX_THREAD_STATE* pState = AfxGetThreadState(); CWinApp* pApp = AfxGetApp(); BOOL bIdle = TRUE; LONG lIdleCount = 0; // phase1: check to see if we can do idle work while (bIdle && !::PeekMessage(&pState->m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)) { // call OnIdle while in bIdle state if (!pApp->OnIdle(lIdleCount++)) bIdle = FALSE; // assume "no idle" state } // phase2: pump messages while available while (::PeekMessage(&pState->m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)) { // pump message, but quit on WM_QUIT if (!pApp->PumpMessage()) { Terminate(); pApp->ExitInstance(); } } ::Sleep(0); }
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:28,
示例9: AfxGetThreadStateint PASCAL CSocket::ProcessAuxQueue(){ AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); if (pThreadState->m_listSocketNotifications.IsEmpty()) return 0; int nCount = 0; while(!pThreadState->m_listSocketNotifications.IsEmpty()) { nCount++; MSG* pMsg = (MSG*)pThreadState->m_listSocketNotifications.RemoveHead(); ASSERT(pMsg != NULL); if (pMsg->message == WM_SOCKET_NOTIFY) { CAsyncSocket::DoCallBack(pMsg->wParam, pMsg->lParam); } else { ASSERT(CAsyncSocket::LookupHandle((SOCKET)pMsg->wParam, TRUE) != NULL); CAsyncSocket::DetachHandle((SOCKET)pMsg->wParam, TRUE); } delete pMsg; } return nCount;}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:27,
示例10: ASSERT_VALID//////////////////// DoModal override copied mostly from MFC, with modification to use// m_ofnEx instead of m_ofn.//int CFileDialogEx::DoModal(){ ASSERT_VALID(this); ASSERT(m_ofn.Flags & OFN_ENABLEHOOK); ASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook // zero out the file buffer for consistent parsing later ASSERT(AfxIsValidAddress(m_ofn.lpstrFile, m_ofn.nMaxFile)); DWORD nOffset = lstrlen(m_ofn.lpstrFile)+1; ASSERT(nOffset <= m_ofn.nMaxFile); memset(m_ofn.lpstrFile+nOffset, 0, (m_ofn.nMaxFile-nOffset)*sizeof(TCHAR)); // WINBUG: This is a special case for the file open/save dialog, // which sometimes pumps while it is coming up but before it has // disabled the main window. HWND hWndFocus = ::GetFocus(); BOOL bEnableParent = FALSE; m_ofn.hwndOwner = PreModal(); AfxUnhookWindowCreate(); if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { bEnableParent = TRUE; ::EnableWindow(m_ofn.hwndOwner, FALSE); } _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); ASSERT(pThreadState->m_pAlternateWndInit == NULL); if (m_ofn.Flags & OFN_EXPLORER) pThreadState->m_pAlternateWndInit = this; else AfxHookWindowCreate(this); memset(&m_ofnEx, 0, sizeof(m_ofnEx)); memcpy(&m_ofnEx, &m_ofn, sizeof(m_ofn)); if (IsWin2000()) m_ofnEx.lStructSize = sizeof(m_ofnEx); int nResult; if (m_bOpenFileDialog) nResult = ::GetOpenFileName((OPENFILENAME*)&m_ofnEx); else nResult = ::GetSaveFileName((OPENFILENAME*)&m_ofnEx); memcpy(&m_ofn, &m_ofnEx, sizeof(m_ofn)); m_ofn.lStructSize = sizeof(m_ofn); if (nResult) ASSERT(pThreadState->m_pAlternateWndInit == NULL); pThreadState->m_pAlternateWndInit = NULL; // WINBUG: Second part of special case for file open/save dialog. if (bEnableParent) ::EnableWindow(m_ofnEx.hwndOwner, TRUE); if (::IsWindow(hWndFocus)) ::SetFocus(hWndFocus); PostModal(); return nResult ? nResult : IDCANCEL;}
开发者ID:janker007,项目名称:cocoshun,代码行数:64,
示例11: ASSERTvoid PASCAL CAsyncSocket::DetachHandle(SOCKET hSocket, BOOL bDead){ ASSERT(CAsyncSocket::LookupHandle(hSocket, bDead) != NULL); AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); if (!bDead) { pThreadState->m_mapSocketHandle.RemoveKey((void*)hSocket); if (pThreadState->m_mapSocketHandle.IsEmpty()) { ASSERT(pThreadState->m_hSocketWindow != NULL); CWnd* pWnd = CWnd::FromHandlePermanent(pThreadState->m_hSocketWindow); ASSERT_VALID(pWnd); pWnd->DestroyWindow(); delete pWnd; pThreadState->m_hSocketWindow = NULL; pThreadState->m_mapDeadSockets.RemoveAll(); } } else { pThreadState->m_mapDeadSockets.RemoveKey((void*)hSocket); }}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:28,
示例12: dcvoid CMDITabs::OnPaint() { CPaintDC dc(this); if (GetItemCount() == 0) return; // do nothing int dcState = dc.SaveDC(); // windows should draw the control as usual _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); pThreadState->m_lastSentMsg.wParam = WPARAM(HDC(dc)); Default(); dc.RestoreDC(dcState); DWORD face = ::GetSysColor(COLOR_3DFACE); if (m_bTop) { CRect rect(0, m_height - 7, m_width, m_height); dc.FillSolidRect(&rect, face); } else { CRect rect(0, 0, m_width, 3); dc.FillSolidRect(&rect, face); } }
开发者ID:RKelson93,项目名称:mushclient,代码行数:27,
示例13: AfxGetThreadStateCOleControlLock::COleControlLock(REFCLSID clsid){ // initialize the object m_pNextLock = NULL; m_clsid = clsid; m_pClassFactory = NULL; // initialize OLE, if necessary _AFX_THREAD_STATE* pState = AfxGetThreadState(); if (!pState->m_bNeedTerm && !AfxOleInit()) return; // attempt to lock the class factory of the control if (SUCCEEDED(::CoGetClassObject(clsid, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, NULL, IID_IClassFactory, (void**)&m_pClassFactory))) { ASSERT(m_pClassFactory != NULL); if (FAILED(m_pClassFactory->LockServer(TRUE))) { m_pClassFactory->Release(); m_pClassFactory = NULL; } }}
开发者ID:Rupan,项目名称:winscp,代码行数:25,
示例14: _AfxMsgFilterHookstatic LRESULT CALLBACK _AfxMsgFilterHook(int code, WPARAM wParam, LPARAM lParam) { CWinThread* pThread; if (AfxGetModuleState()->m_bDLL || (code < 0 && code != MSGF_DDEMGR) || !(pThread = AfxGetThread())) return AfxGetThreadState()->m_hookMsg.CallNext(code, wParam, lParam); ASSERT(pThread != NULL); return (LRESULT)pThread->ProcessMessageFilter(code, (LPMSG)lParam);}
开发者ID:sirmax1,项目名称:coin,代码行数:7,
示例15: AfxCriticalNewHandlerint AFX_CDECL AfxCriticalNewHandler(size_t nSize) // nSize is already rounded{ // called during critical memory allocation // free up part of the app's safety cache TRACE0("Warning: Critical memory allocation failed!/n"); _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); if (pThreadState != NULL && pThreadState->m_pSafetyPoolBuffer != NULL) { size_t nOldBufferSize = _msize(pThreadState->m_pSafetyPoolBuffer); if (nOldBufferSize <= nSize + MIN_MALLOC_OVERHEAD) { // give it all up TRACE0("Warning: Freeing application's memory safety pool!/n"); free(pThreadState->m_pSafetyPoolBuffer); pThreadState->m_pSafetyPoolBuffer = NULL; } else { BOOL bEnable = AfxEnableMemoryTracking(FALSE); _expand(pThreadState->m_pSafetyPoolBuffer, nOldBufferSize - (nSize + MIN_MALLOC_OVERHEAD)); AfxEnableMemoryTracking(bEnable); TRACE3("Warning: Shrinking safety pool from %d to %d to satisfy request of %d bytes./n", nOldBufferSize, _msize(pThreadState->m_pSafetyPoolBuffer), nSize); } return 1; // retry it } TRACE0("ERROR: Critical memory allocation from safety pool failed!/n"); AfxThrowMemoryException(); // oops return 0;}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:33,
示例16: AfxGetThreadState//////////////////// Like calling base class WindowProc, but with no args, so individual// message handlers can do the default thing. Like CWnd::Default//LRESULT CSubclassWnd::Default(){ // MFC stores current MSG in thread state MSG& curMsg = AfxGetThreadState()->m_lastSentMsg; // Note: must explicitly call CSubclassWnd::WindowProc to avoid infinte // recursion on virtual function return CSubclassWnd::WindowProc(curMsg.message, curMsg.wParam, curMsg.lParam);}
开发者ID:SoyPay,项目名称:DacrsUI,代码行数:12,
示例17: AfxGetThreadState// ==> XP Style Menu [Xanatos] - Stullevoid CStatisticsTree::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { HMENU hMenu = AfxGetThreadState()->m_hTrackingMenu; if(CMenu *pMenu = CMenu::FromHandle(hMenu)) pMenu->MeasureItem(lpMeasureItemStruct); CTreeCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);}
开发者ID:brolee,项目名称:EMule-GIFC,代码行数:9,
示例18: AfxGetThreadStatevoid CDownloadClientsCtrl::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { HMENU hMenu = AfxGetThreadState()->m_hTrackingMenu; CMenu *pMenu = CMenu::FromHandle(hMenu); pMenu->MeasureItem(lpMeasureItemStruct); CWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:8,
示例19: AfxGetThreadState// ==> XP Style Menu [Xanatos] - Stullevoid CPPgScheduler::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { HMENU hMenu = AfxGetThreadState()->m_hTrackingMenu; if(CMenu *pMenu = CMenu::FromHandle(hMenu)) pMenu->MeasureItem(lpMeasureItemStruct); CPropertyPage::OnMeasureItem(nIDCtl, lpMeasureItemStruct);}
开发者ID:rusingineer,项目名称:StulleMule,代码行数:9,
示例20: AfxGetThreadStateINT_PTR CColorDialog::DoModal()/*****************************/{ _AFX_THREAD_STATE *pState = AfxGetThreadState(); ASSERT( pState != NULL ); ASSERT( pState->m_pAlternateWndInit == NULL ); pState->m_pAlternateWndInit = this; return( ::ChooseColor( &m_cc ) ? IDOK : IDCANCEL );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:9,
示例21: DoSizeDetailsBOOL CSearchWnd::DoSizeDetails(){ MSG* pMsg = &AfxGetThreadState()->m_msgCur; CRect rcClient; CPoint point; GetClientRect( &rcClient ); if ( m_bPanel ) rcClient.left += Settings.Skin.SidebarWidth; if ( ! ( m_bPaused || m_bWaitMore ) ) rcClient.top += STATUS_HEIGHT; rcClient.bottom -= Settings.Skin.ToolbarHeight; ClientToScreen( &rcClient ); ClipCursor( &rcClient ); SetCapture(); ScreenToClient( &rcClient ); int nOffset = 0xFFFF; while ( GetAsyncKeyState( VK_LBUTTON ) & 0x8000 ) { while ( ::PeekMessage( pMsg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ) ); if ( ! AfxGetThread()->PumpMessage() ) { AfxPostQuitMessage( 0 ); break; } GetCursorPos( &point ); ScreenToClient( &point ); int nSplit = rcClient.bottom - point.y; if ( nOffset == 0xFFFF ) nOffset = m_nDetails - nSplit; nSplit += nOffset; if ( nSplit < 8 ) nSplit = 0; if ( nSplit > rcClient.Height() - Settings.Skin.Splitter - 8 ) nSplit = rcClient.Height() - Settings.Skin.Splitter; if ( nSplit != m_nDetails ) { m_nDetails = nSplit; Settings.Search.DetailPanelSize = nSplit; OnSize( SIZE_INTERNAL, 0, 0 ); Invalidate(); } } ReleaseCapture(); ClipCursor( NULL ); return TRUE;}
开发者ID:qing3962,项目名称:peerproject,代码行数:57,
示例22: AfxGetThreadState//****************************************************************************************void CBCGFontComboBox::PreSubclassWindow() { CComboBox::PreSubclassWindow(); _AFX_THREAD_STATE* pThreadState = AfxGetThreadState (); if (pThreadState->m_pWndInit == NULL) { Init (); }}
开发者ID:SnipeDragon,项目名称:gamecq,代码行数:11,
示例23: DoSizePanelBOOL CLibraryFrame::DoSizePanel(){ MSG* pMsg = &AfxGetThreadState()->m_msgCur; CRect rcClient; CPoint point; GetClientRect( &rcClient ); rcClient.left += m_nTreeSize + Settings.Skin.Splitter; rcClient.top += Settings.Skin.ToolbarHeight + m_nHeaderSize; rcClient.bottom -= Settings.Skin.ToolbarHeight; ClientToScreen( &rcClient ); ClipCursor( &rcClient ); SetCapture(); ScreenToClient( &rcClient ); int nOffset = 0xFFFF; while ( GetAsyncKeyState( VK_LBUTTON ) & 0x8000 ) { while ( ::PeekMessage( pMsg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ) ); if ( ! AfxGetThread()->PumpMessage() ) { AfxPostQuitMessage( 0 ); break; } GetCursorPos( &point ); ScreenToClient( &point ); int nSplit = rcClient.bottom - point.y; if ( nOffset == 0xFFFF ) nOffset = m_nPanelSize - nSplit; nSplit += nOffset; if ( nSplit < 8 ) nSplit = 0; if ( nSplit > rcClient.Height() - Settings.Skin.Splitter - 8 ) nSplit = rcClient.Height() - Settings.Skin.Splitter; if ( nSplit != m_nPanelSize ) { m_nPanelSize = nSplit; OnSize( 1982, 0, 0 ); Invalidate(); } } ReleaseCapture(); ClipCursor( NULL ); return TRUE;}
开发者ID:GetEnvy,项目名称:Envy,代码行数:55,
示例24: ASSERT_VALIDint CPlayerMgr::Run(){ // TODO: 在此添加专用代码和/或调用基类 ASSERT_VALID(this);#ifndef _AFXDLL #define _AFX_SOCK_THREAD_STATE AFX_MODULE_THREAD_STATE #define _afxSockThreadState AfxGetModuleThreadState() _AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState; if (pState->m_pmapSocketHandle == NULL) pState->m_pmapSocketHandle = new CMapPtrToPtr; if (pState->m_pmapDeadSockets == NULL) pState->m_pmapDeadSockets = new CMapPtrToPtr; if (pState->m_plistSocketNotifications == NULL) pState->m_plistSocketNotifications = new CPtrList; #endif if (!m_skListen.Socket(SOCK_STREAM, FD_ACCEPT)) return false; srand(time(NULL)); WORD nListenPort; while(true) {#ifdef _DEBUG nListenPort = 8880;#else nListenPort = 3000 + rand() % 1200;#endif if(m_skListen.Bind(nListenPort)) break; else { TRACE("bind error: %d/n", WSAGetLastError()); } } m_nListenPort = nListenPort; m_skListen.Listen(5); _AFX_THREAD_STATE* pTState = AfxGetThreadState(); while(true) { Process(); if(::PeekMessage(&(pTState->m_msgCur), NULL, NULL, NULL, PM_NOREMOVE)) { if (!PumpMessage()) return ExitInstance(); } } return 0;}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:54,
示例25: DoSizeViewBOOL CChatWnd::DoSizeView(){ MSG* pMsg = &AfxGetThreadState()->m_msgCur; CRect rcClient; GetClientRect( &rcClient ); ClientToScreen( &rcClient ); ClipCursor( &rcClient ); SetCapture(); GetClientRect( &rcClient ); int nOffset = 0xFFFF; while ( GetAsyncKeyState( VK_LBUTTON ) & 0x8000 ) { while ( ::PeekMessage( pMsg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ) ); if ( ! AfxGetThread()->PumpMessage() ) { AfxPostQuitMessage( 0 ); break; } CPoint point; GetCursorPos( &point ); ScreenToClient( &point ); int nSplit = rcClient.right - point.x; if ( nOffset == 0xFFFF ) nOffset = m_nUsersSize - nSplit; nSplit += nOffset; nSplit = max( nSplit, 0 ); nSplit = min( nSplit, (int)rcClient.right - SPLIT_SIZE ); if ( nSplit < 8 ) nSplit = 0; if ( nSplit > rcClient.right - SPLIT_SIZE - 8 ) nSplit = rcClient.right - SPLIT_SIZE; if ( nSplit != m_nUsersSize ) { m_nUsersSize = nSplit; OnSize( 1982, 0, 0 ); Invalidate(); } } ReleaseCapture(); ClipCursor( NULL ); return TRUE;}
开发者ID:nlstone,项目名称:Shareaza,代码行数:54,
示例26: AfxWinTermvoid AFXAPI AfxWinTerm(void){#ifdef _MAC AERemoveEventHandler(kCoreEventClass, kAEOpenApplication, _afxPfnOpenApp, false); AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, _afxPfnOpenDoc, false); AERemoveEventHandler(kCoreEventClass, kAEPrintDocuments, _afxPfnPrintDoc, false); AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, _afxPfnQuit, false);#endif // unregister Window classes AFX_MODULE_STATE* pModuleState = AfxGetModuleState(); AfxLockGlobals(CRIT_REGCLASSLIST); LPTSTR lpsz = pModuleState->m_szUnregisterList; while (*lpsz != 0) { LPTSTR lpszEnd = _tcschr(lpsz, '/n'); ASSERT(lpszEnd != NULL); *lpszEnd = 0; UnregisterClass(lpsz, AfxGetInstanceHandle()); lpsz = lpszEnd + 1; } pModuleState->m_szUnregisterList[0] = 0; AfxUnlockGlobals(CRIT_REGCLASSLIST); // cleanup OLE if required CWinApp* pApp = AfxGetApp(); if (pApp != NULL && pApp->m_lpfnOleTermOrFreeLib != NULL) (*pApp->m_lpfnOleTermOrFreeLib)(TRUE, FALSE); // cleanup thread local tooltip window _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); if (pThreadState->m_pToolTip != NULL) { if (pThreadState->m_pToolTip->DestroyToolTipCtrl()) pThreadState->m_pToolTip = NULL; } if (!afxContextIsDLL) { // unhook windows hooks if (pThreadState->m_hHookOldMsgFilter != NULL) { ::UnhookWindowsHookEx(pThreadState->m_hHookOldMsgFilter); pThreadState->m_hHookOldMsgFilter = NULL; } if (pThreadState->m_hHookOldCbtFilter != NULL) { ::UnhookWindowsHookEx(pThreadState->m_hHookOldCbtFilter); pThreadState->m_hHookOldCbtFilter = NULL; } }}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:53,
示例27: AfxGetThreadStateBOOL CMenu::TrackPopupMenuEx( UINT fuFlags, int x, int y, CWnd *pWnd, LPTPMPARAMS lptpm )/***************************************************************************************/{ _AFX_THREAD_STATE *pState = AfxGetThreadState(); ASSERT( pState != NULL ); pState->m_hTrackingWindow = pWnd->GetSafeHwnd(); pState->m_hTrackingMenu = m_hMenu; BOOL bRet = ::TrackPopupMenuEx( m_hMenu, fuFlags, x, y, pWnd->GetSafeHwnd(), lptpm ); pState->m_hTrackingWindow = NULL; pState->m_hTrackingMenu = NULL; return( bRet );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:12,
示例28: ASSERT_VALIDvoid CProtectedWinThread::PumpMessages(){ ASSERT_VALID(this); // for tracking the idle time state BOOL bIdle = TRUE; LONG lIdleCount = 0;#if _MFC_VER >= 0x0710 _AFX_THREAD_STATE* pState = AfxGetThreadState(); MSG &msgCur = pState->m_msgCur;#else MSG &msgCur = m_msgCur;#endif /* _MFC_VER_ */ // acquire and dispatch messages until a WM_QUIT message is received. for (;;) { // phase1: check to see if we can do idle work while (bIdle && !::PeekMessage(&msgCur, NULL, NULL, NULL, PM_NOREMOVE)) { // call OnIdle while in bIdle state if (!OnIdle(lIdleCount++)) bIdle = FALSE; // assume "no idle" state } // phase2: pump messages while available do { // pump message, but quit on WM_QUIT if (!PumpMessage()) {#if defined(_DEBUG)# if _MFC_VER < 0x0710 m_nDisablePumpCount--; // application must NOT die# else pState->m_nDisablePumpCount--; // application must NOT die# endif#endif return; } // reset "no idle" state after pumping "normal" message if (IsIdleMessage(&msgCur)) { bIdle = TRUE; lIdleCount = 0; } } while (::PeekMessage(&msgCur, NULL, NULL, NULL, PM_NOREMOVE)); } ASSERT(FALSE); // not reachable}
开发者ID:malrsrch,项目名称:pywin32,代码行数:52,
注:本文中的AfxGetThreadState函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AfxInitExtensionModule函数代码示例 C++ AfxGetStaticModuleState函数代码示例 |