.h
//////
HANDLE m_hLoadingThread;
DWORD m_dLoadingThreadID;
BOOL m_bLoadingThreadFlag;
static DWORD WINAPI LoadingThreadProc(LPVOID pThis);
//////////////////////////////////////////
.cpp
///////
///Start/////
m_hLoadingThread = ::CreateThread(NULL, 0, CUPnPAction::LoadingThreadProc, this, 0, &m_dLoadingThreadID);
///RUN/////
DWORD WINAPI CUPnPAction::LoadingThreadProc(LPVOID pThis)
{
char ErrMsg[MAX_PATH];
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
OutputDebugString("LTP_Loading thread start\n");
CUPnPAction *pUPnPAction = (CUPnPAction*)pThis;
pUPnPAction->m_bLoadingThreadFlag = TRUE;
do
{
} while (pUPnPAction->m_bLoadingThreadFlag && ulMatches > ulStartIndex && SUCCEEDED(hr));
return S_OK;
}
///END/////
if (0 != m_hLoadingThread)
{
DWORD dwExitCode = 0;
GetExitCodeThread(m_hLoadingThread, &dwExitCode);
if (STILL_ACTIVE == dwExitCode)
{
m_bLoadingThreadFlag = FALSE;
WaitForSingleObject(m_hLoadingThread, INFINITE);
}
CloseHandle(m_hLoadingThread);
m_hLoadingThread = 0;
}
2009年4月6日 星期一
OutputDebugStringW
如果遇到這個型態,其它的都要改成W型態,例子:
wchar_t ErrMsg[MAX_PATH];
wsprintf(ErrMsg, L"LTPTime_ CGGOpenFromFile::_updateLocalFileItem FOR loop time usage= %d \n", dTickCountB - dTickCountA);
OutputDebugString(ErrMsg);
//////////
char DebugString[256];
sprintf(DebugString,"[DTCP]Condition meet to set ICT to %d\n",IctToApply);
OutputDebugStringA(DebugString);
wchar_t ErrMsg[MAX_PATH];
wsprintf(ErrMsg, L"LTPTime_ CGGOpenFromFile::_updateLocalFileItem FOR loop time usage= %d \n", dTickCountB - dTickCountA);
OutputDebugString(ErrMsg);
//////////
char DebugString[256];
sprintf(DebugString,"[DTCP]Condition meet to set ICT to %d\n",IctToApply);
OutputDebugStringA(DebugString);
訂閱:
文章 (Atom)