Exemplo n.º 1
0
void CALLBACK UpgradeCallBackFunc(LONG lLoginID, LONG lUpgradechannel, int nTotalSize, int nSendSize, DWORD dwUser)
{
	CNetUpgrade * pThis = (CNetUpgrade *)dwUser;
	if (-1 == nSendSize)
	{
		pThis->SetProgressPos(-1);
	}
	else if (-2 == nSendSize)
	{
		pThis->SetProgressPos(-2);
	}
	else if (-1 == nTotalSize)//升级进度回调
	{
		char szTemp[128] = {0};
		sprintf(szTemp, "===nUpdate: %d\n", nSendSize);
		OutputDebugStringA(szTemp);
		if (nSendSize < 0 || nSendSize > 100)
		{
		}
		else
		{
			//pThis->SetProgressPos(nSendSize);
			pThis->PostMessage(WM_SETPROGRESS, 0, nSendSize);
		}
	}
	else
	{
		int nProgress = nSendSize/(nTotalSize/100);
		char szTemp[256] = {0};
		sprintf(szTemp, "nProgress: %d, nSendSize: %d, nTotalSize: %d\n", nProgress, nSendSize, nTotalSize);
		OutputDebugStringA(szTemp);
		pThis->SetProgressPos(nProgress);
	}	
	return;
}
Exemplo n.º 2
0
void CALLBACK UpgradeCallBackFunc(LONG lLoginID, LONG lUpgradechannel, int nTotalSize, int nSendSize, DWORD dwUser)
{
	CNetUpgrade * pThis = (CNetUpgrade *)dwUser;
	if (-1 == nSendSize)
	{
		pThis->SetProgressPos(-1);
	}
	else if (-2 == nSendSize)
	{
		pThis->SetProgressPos(-2);
	}
	else if (-1 == nTotalSize)//升级进度回调
	{
		if (nSendSize < 0 || nSendSize > 100)
		{
		}
		else
		{
			pThis->SetProgressPos(nSendSize);
		}
	}
	else
	{
		int nProgress = 100 * nSendSize/nTotalSize;
		pThis->SetProgressPos(nProgress);
	}	
	return;
}