当前位置: 首页>>代码示例>>C++>>正文


C++ CAsynMsgWindow::PostMessage方法代码示例

本文整理汇总了C++中CAsynMsgWindow::PostMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ CAsynMsgWindow::PostMessage方法的具体用法?C++ CAsynMsgWindow::PostMessage怎么用?C++ CAsynMsgWindow::PostMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAsynMsgWindow的用法示例。


在下文中一共展示了CAsynMsgWindow::PostMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
开发者ID:yuanbaoyuele,项目名称:yuanbaoyule,代码行数:13,代码来源:LuaAsynAPIUtil.cpp

示例2: 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);
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:9,代码来源:LuaAsynAPIUtil.cpp

示例3: 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;
}
开发者ID:yuanbaoyuele,项目名称:yuanbaoyule,代码行数:18,代码来源:LuaAsynAPIUtil.cpp

示例4: 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);
	//	}
	//}
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:19,代码来源:LuaAsynUtil.cpp

示例5: 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
	{
//.........这里部分代码省略.........
开发者ID:yuanbaoyuele,项目名称:yuanbaoyule,代码行数:101,代码来源:LuaAsynAPIUtil.cpp


注:本文中的CAsynMsgWindow::PostMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。