本文整理汇总了C++中CAsynMsgWindow类的典型用法代码示例。如果您正苦于以下问题:C++ CAsynMsgWindow类的具体用法?C++ CAsynMsgWindow怎么用?C++ CAsynMsgWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAsynMsgWindow类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Work
void CWaitObjData::Work()
{
DWORD dwRet = WaitForSingleObject(m_hProcess, m_dwTimeout);
TSDEBUG4CXX(L"[AsynWaitForSingleObject] WaitForSingleObject = " << dwRet);
if (dwRet == WAIT_FAILED)
{
g_wndMsg.PostMessage(WM_WAITOBJECTFINISH, GetLastError(), (LPARAM) this);
}
else
{
g_wndMsg.PostMessage(WM_WAITOBJECTFINISH, 0, (LPARAM) this);
}
}
示例2:
void* __stdcall LuaAsynUtil::GetInstance( void* )
{
static LuaAsynUtil s_instance;
if (g_wndMsg.m_hWnd == NULL)
g_wndMsg.Create(HWND_MESSAGE);
return &s_instance;
}
示例3: Work
void GetFileSizeWithUrlData::Work()
{
TSTRACEAUTO();
INT64 iFileSize = 0;
BOOL bRet = gMiniTPWrapper.GetFileSizeWithUrl(m_strUrl.c_str(),m_iFileSize);
WPARAM wParam = bRet?0:1;
g_wndMsg.PostMessage(WM_GETFILESIZEWITHURL, wParam, (LPARAM)this);
}
示例4: SoftExit
//SoftExit
int LuaAsynUtil::SoftExit(lua_State* pLuaState)
{
if (g_wndMsg.m_hWnd != NULL)
{
g_wndMsg.DestroyWindow();
g_wndMsg.m_hWnd = NULL;
}
theApp.ExitInstance();
return 0;
}
示例5: StartTimerEx
int LuaAsynUtil::StartTimerEx(lua_State* pLuaState)
{
UINT nElapse = lua_tointeger(pLuaState, 2);
if (lua_isfunction(pLuaState, 3))
{
CTimerCallBackProcMgr* pData = new CTimerCallBackProcMgr(nElapse, pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
UINT_PTR nTimerID = g_wndMsg.StartTimer(nElapse, pData);
lua_pushinteger(pLuaState, nTimerID);
return 1;
}
return 0;
}
示例6: OnProgress
STDMETHODIMP TCallback::OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
if (ulProgress > 0 && ulProgressMax > ulProgress)
{
double percent=(ulProgress*1.0f)/(ulProgressMax);
//TSDEBUG(L"ulProgress = %ul,ulProgressMax = %ul, percent = %lf, m_percent = %lf",ulProgress,ulProgressMax,percent,m_percent);
if (percent < m_percent+0.01f)
{
return S_OK;
}
m_percent = percent;
PDOWNLOAD_PROGRESS pdp = new DOWNLOAD_PROGRESS;
pdp->ulProgress = ulProgress;
pdp->ulProgressMax = ulProgressMax;
g_wndMsg.PostMessage(WM_HTTPFILEGOTPROGRESS, (WPARAM)pdp, (LPARAM)this->m_pGetHttpFileData);
}
return S_OK;
}
示例7: Work
void HttpStatData::Work()
{
//try
//{
TCHAR szPath[MAX_PATH] = {0};
URLDownloadToCacheFile(NULL, m_strUrl.c_str(), szPath, MAX_PATH, 0, NULL);
if (m_bAsync)
{
g_wndMsg.PostMessage(WM_SENDHTTPSTAT, 0, (LPARAM) this);
}
//}
//catch (...)
//{
// if (m_bAsync)
// {
// g_wndMsg.PostMessage(WM_SENDHTTPSTAT, -1, (LPARAM) this);
// }
//}
}
示例8: StopTimerEx
int LuaAsynUtil::StopTimerEx(lua_State* pLuaState)
{
UINT_PTR nTimerID = lua_tointeger(pLuaState, 2);
g_wndMsg.StopTimer(nTimerID);
return 0;
}
示例9: StopAllTimerEx
int LuaAsynUtil::StopAllTimerEx(lua_State* pLuaState)
{
g_wndMsg.StopAllTimer();
return 0;
}
示例10: OnStateChange
///////////////Ajax OnStateChange实现部分
STDMETHODIMP LuaAsynUtil::OnStateChange(CAJAX* pSource, const bool bSucceeded, const int nHttpState, const BSTR /*bstrResponse*/, IDispatch* pDispath)
{
if(bSucceeded && (nHttpState >= 200 && nHttpState < 300 ))
{
if (pSource->m_bOutDOM)
{
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILESUCCESS, pSource->m_nID, (LPARAM)pSource);
}
else //存成文件
{
if ((AjaxTaskFlag)pSource->m_nID == AJAXTASKFLAG_SENDHTTPSTAT || (AjaxTaskFlag)pSource->m_nID == AJAXTASKFLAG_SENDHTTPSTATEX)
{
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILESUCCESS, pSource->m_nID, (LPARAM)pSource);
}
else
{
CComBSTR bstrSavedPath = pSource->m_bstrSavedPath;
MSXML::IXMLHttpRequestPtr pRequest(pDispath);
if ((AjaxTaskFlag)pSource->m_nID == AJAXTASKFLAG_GETHTTPCONTENT)
{
//try
//{
CComBSTR bstrContent;
pRequest->get_responseText(&bstrContent);
pSource->m_bstrSavedPath = L"";
pSource->m_bstrSavedPath.AppendBSTR(bstrContent);
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILESUCCESS, pSource->m_nID, (LPARAM)pSource);
//}
//catch (...)
//{
// g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILEFAILED, pSource->m_nID, (LPARAM)pSource);
//}
}
else if ((AjaxTaskFlag)pSource->m_nID == AJAXTASKFLAG_GETHTTPFILE)
{
CComVariant varStream;
pRequest->get_responseStream(&varStream);
if (varStream.vt != VT_UNKNOWN && varStream.vt != VT_STREAM)
{
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILEFAILED, pSource->m_nID, (LPARAM)pSource);
}
else
{
wchar_t szPath[_MAX_PATH] = {0};
wcsncpy(szPath, bstrSavedPath, _MAX_PATH);
PathRemoveFileSpec(szPath);
if(!PathFileExists(szPath))
SHCreateDirectory(NULL, szPath);
//写文件
HANDLE hFile = ::CreateFile((LPCTSTR)bstrSavedPath,GENERIC_WRITE,0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
// 可能目录只读, 存到programdata/temp下
if (hFile == INVALID_HANDLE_VALUE)
{
static CComBSTR bstrPath;
if(bstrPath.Length() <= 0)
{
wchar_t szPath[MAX_PATH] = {0};
DWORD len = GetTempPath(MAX_PATH, szPath);
bstrPath = szPath;
}
if(!PathFileExists(bstrPath))
SHCreateDirectory(NULL, bstrPath);
CComBSTR bstrFileName = PathFindFileName(bstrSavedPath);
CComBSTR bstrPath2(bstrPath);
bstrPath2.AppendBSTR(bstrFileName);
bstrSavedPath = bstrPath2;
hFile = ::CreateFile((LPCTSTR)bstrSavedPath,GENERIC_WRITE,0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
}
if (hFile != INVALID_HANDLE_VALUE)
{
DWORD cb, cbRead, cbWritten;
BYTE bBuffer[4096];
cb = sizeof bBuffer;
CComQIPtr<IStream> pStream(varStream.punkVal);
HRESULT hr = pStream->Read(bBuffer, cb, &cbRead);
while (SUCCEEDED(hr) && 0 != cbRead)
{
if (!WriteFile(hFile, bBuffer, cbRead, &cbWritten, NULL))
break;
hr = pStream->Read(bBuffer, cb, &cbRead);
}
}
CloseHandle(hFile);
pSource->m_bstrSavedPath = bstrSavedPath;
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILESUCCESS, pSource->m_nID, (LPARAM)pSource);
}
}
else
{
g_wndMsg.PostMessage(WM_AJAXDOWNLOADFILESUCCESS, pSource->m_nID, (LPARAM)pSource);
}
}
}
}
else
{
//.........这里部分代码省略.........