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


C++ IBackgroundCopyJob::Complete方法代码示例

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


在下文中一共展示了IBackgroundCopyJob::Complete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyCom_BuildPyException

// @pymethod |PyIBackgroundCopyJob|Complete|Description of Complete.
PyObject *PyIBackgroundCopyJob::Complete(PyObject *self, PyObject *args)
{
	IBackgroundCopyJob *pIBCJ = GetI(self);
	if ( pIBCJ == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":Complete") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIBCJ->Complete( );

	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob );
	return PyInt_FromLong(hr);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyIBackgroundCopyJob.cpp

示例2: BitTransfer

VOID BitTransfer(PWCHAR pSource, PWCHAR pDest)
{
	IBackgroundCopyManager* g_XferManager = NULL;  
	HRESULT hr = S_OK;
	HANDLE hTimer = NULL;

	//hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	if (SUCCEEDED(hr))
	{
		//MessageBox(NULL, L"HRESULT succeeded", L"BUBU", 0);
		hr = CoCreateInstance(__uuidof(BackgroundCopyManager), NULL,
			CLSCTX_LOCAL_SERVER,
			__uuidof(IBackgroundCopyManager),
			(void**) &g_XferManager);
		if (SUCCEEDED(hr))
		{
			//MessageBox(NULL, L"Connected to the BITS service", L"BUBU", 0);
		}
		else 
			return;
	}
	else
		return;

	GUID JobId;
	IBackgroundCopyJob* pJob = NULL;
	hr = g_XferManager->CreateJob(L"WindowsUpdateReaver", BG_JOB_TYPE_DOWNLOAD, &JobId, &pJob);
	if (SUCCEEDED(hr))
	{
		//MessageBox(NULL, L"Job created", L"BUBU", 0);
		hr = pJob->AddFile(pSource, pDest);
		
		if (SUCCEEDED(hr))
		{
			//MessageBox(NULL, L"ile added to job", L"BUBU", 0);
		}
		else
			goto cleanup;
	}
	else
		return;

	HRESULT Resume();
	//MessageBox(NULL, L"Started", L"BUBU", 0);

	BG_JOB_STATE State;
	//HANDLE hTimer = NULL;
	LARGE_INTEGER liDueTime;

	liDueTime.QuadPart = -10000000;  //Poll every 1 second
	hTimer = CreateWaitableTimer(NULL, FALSE, L"WindowsUpdateTimer");
	SetWaitableTimer(hTimer, &liDueTime, 1000, NULL, NULL, 0);

	do
	{
		WaitForSingleObject(hTimer, INFINITE);

		//Use JobStates[State] to set the window text in a user interface.
		hr = pJob->GetState(&State);
		if (FAILED(hr))
		{
			goto cleanup;
			//Handle error
			//MessageBox(NULL, L"FAIL", L"BUBU", 0);
		}

		if (BG_JOB_STATE_TRANSFERRED == State){
			//Call pJob->Complete(); to acknowledge that the transfer is complete
			//and make the file available to the client.
			HRESULT Complete();
			//MessageBox(NULL, L"Job completed", L"BUBU", 0);
		}
		else if (BG_JOB_STATE_ERROR == State || BG_JOB_STATE_TRANSIENT_ERROR == State){
			//Call pJob->GetError(&pError); to retrieve an IBackgroundCopyError interface 
			//pointer which you use to determine the cause of the error.
			//printf("ERROR!\n");
		}
		else if (BG_JOB_STATE_TRANSFERRING == State){
			//Call pJob->GetProgress(&Progress); to determine the number of bytes 
			//and files transferred.
			//MessageBox(NULL, L"Transferring", L"BUBU", 0);
		}
		else if(BG_JOB_STATE_QUEUED == State){
			//MessageBox(NULL, L"QUEUED", L"BUBU", 0);
		}
		else if(BG_JOB_STATE_CONNECTING == State){
			//MessageBox(NULL, L"CONNECTING", L"BUBU", 0);
		}
		else if(BG_JOB_STATE_SUSPENDED == State){
			//MessageBox(NULL, L"BG_JOB_STATE_SUSPENDED", L"BUBU", 0);
			HRESULT Cancel();
			pJob->Resume();
		}
		else if(BG_JOB_STATE_TRANSIENT_ERROR == State){
			//MessageBox(NULL, L"BG_JOB_STATE_TRANSIENT_ERROR", L"BUBU", 0);
		}
		else if(BG_JOB_STATE_ACKNOWLEDGED == State){
			//MessageBox(NULL, L"BG_JOB_STATE_ACKNOWLEDGED", L"BUBU", 0);
		}
		else if(BG_JOB_STATE_CANCELLED == State){
//.........这里部分代码省略.........
开发者ID:BrzTit,项目名称:scout-win,代码行数:101,代码来源:bits.cpp


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