几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » 程序设计 » vc编程
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2007-02-27, 10:28 PM   #1
cam
普通会员
 
注册日期: 07-01
帖子: 44
精华: 2
现金: 206 标准币
资产: 206 标准币
cam 向着好的方向发展
默认 C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc\thrdcore.cpp

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc\thrdcore.cpp

UINT APIENTRY _AfxThreadEntry(void* pParam)

{

_AFX_THREAD_STARTUP* pStartup = (_AFX_THREAD_STARTUP*)pParam;

ASSERT(pStartup != NULL);

ASSERT(pStartup->pThreadState != NULL);

ASSERT(pStartup->pThread != NULL);

ASSERT(pStartup->hEvent != NULL);

ASSERT(!pStartup->bError);



CWinThread* pThread = pStartup->pThread;

CWnd threadWnd;

TRY

{

// inherit parent's module state

_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();

pThreadState->m_pModuleState = pStartup->pThreadState->m_pModuleState;



// set current thread pointer for AfxGetThread

AFX_MODULE_STATE* pModuleState = AfxGetModuleState();

#ifdef _AFXDLL

pThread->m_pModuleState = pModuleState;

#endif

AFX_MODULE_THREAD_STATE* pState = pModuleState->m_thread;

pState->m_pCurrentWinThread = pThread;



// forced initialization of the thread

AfxInitThread();



// thread inherits app's main window if not already set

CWinApp* pApp = AfxGetApp();

if (pApp != NULL &&

pThread->m_pMainWnd == NULL && pApp->m_pMainWnd->GetSafeHwnd() != NULL)

{

// just attach the HWND

threadWnd.Attach(pApp->m_pMainWnd->m_hWnd);

pThread->m_pMainWnd = &threadWnd;

}

}

CATCH_ALL(e)

{

// Note: DELETE_EXCEPTION(e) not required.



// exception happened during thread initialization!!

TRACE(traceAppMsg, 0, "Warning: Error during thread initialization!\n");



// set error flag and allow the creating thread to notice the error

threadWnd.Detach();

pStartup->bError = TRUE;

VERIFY(::SetEvent(pStartup->hEvent));

AfxEndThread((UINT)-1, FALSE);

ASSERT(FALSE); // unreachable

}

END_CATCH_ALL



// pStartup is invlaid after the following

// SetEvent (but hEvent2 is valid)

HANDLE hEvent2 = pStartup->hEvent2;



// allow the creating thread to return from CWinThread::CreateThread

VERIFY(::SetEvent(pStartup->hEvent));



// wait for thread to be resumed

VERIFY(::WaitForSingleObject(hEvent2, INFINITE) == WAIT_OBJECT_0);

::CloseHandle(hEvent2);



// first -- check for simple worker thread

DWORD nResult = 0;

if (pThread->m_pfnThreadProc != NULL)

{

nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);

ASSERT_VALID(pThread);

}

// else -- check for thread with message loop

else if (!pThread->InitInstance())

{

ASSERT_VALID(pThread);

nResult = pThread->ExitInstance();

}

else

{

// will stop after PostQuitMessage called

ASSERT_VALID(pThread);

nResult = pThread->Run();

}



// cleanup and shutdown the thread

threadWnd.Detach();

AfxEndThread(nResult);



return 0; // not reached

}
cam离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 07:16 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多