Ejemplo n.º 1
0
void WinSevenTaskbar::createInterface(void)
{
	if(!m_ptbl)
	{
		ITaskbarList3 *ptbl = NULL;
		HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&ptbl));

		if (SUCCEEDED(hr))
		{
			HRESULT hr2 = ptbl->HrInit();
			if(SUCCEEDED(hr2))
			{
				m_ptbl = ptbl;
				/*qDebug("ITaskbarList3::HrInit() succeeded.");*/
			}
			else
			{
				ptbl->Release();
				qWarning("ITaskbarList3::HrInit() has failed.");
			}
		}
		else
		{
			qWarning("ITaskbarList3 could not be created.");
		}
	}
}
Ejemplo n.º 2
0
void UnregisterTab(HWND tab)
{
	ITaskbarList3 *taskbar;

	if(!(tab))
		return;

	if(S_OK != CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&taskbar))
		return;
	taskbar->HrInit();
	taskbar->UnregisterTab(tab);
	taskbar->Release();
}
Ejemplo n.º 3
0
void SetTabActive(HWND tab, HWND owner)
{
	ITaskbarList3 *taskbar;

	if(!owner)
		return;

	if(S_OK != CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&taskbar))
		return;

	taskbar->HrInit();
	taskbar->SetTabActive(tab, owner, 0);
	taskbar->Release();
}
Ejemplo n.º 4
0
void SetTabOrder(HWND tab, HWND insertBefore)
{
	ITaskbarList3 *taskbar;

	if(!tab)
		return;

	if(S_OK != CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&taskbar))
		return;

	taskbar->HrInit();
	taskbar->SetTabOrder(tab, insertBefore);
	taskbar->Release();
}
Ejemplo n.º 5
0
    TaskBarIface() : m_taskbarInterface(NULL)
    {
        HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, reinterpret_cast<void**> (&(m_taskbarInterface)));

        if (SUCCEEDED(hr))
        {
            hr = m_taskbarInterface->HrInit();

            if (FAILED(hr))
            {
                m_taskbarInterface->Release();
                m_taskbarInterface = NULL;
            }
        }
    }
Ejemplo n.º 6
0
void SetProgressState(HWND hWnd, ProgressStates state)
{
	TBPFLAG flags;
	ITaskbarList3 *taskbar;
	if(S_OK != CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&taskbar))
		return;
	taskbar->HrInit();
	switch (state)	{
		default:
		case PS_None          : flags = TBPF_NOPROGRESS;    break;
		case PS_Normal        : flags = TBPF_NORMAL;        break;
		case PS_Paused        : flags = TBPF_PAUSED;        break;
		case PS_Error         : flags = TBPF_ERROR;         break;
		case PS_Indeterminate : flags = TBPF_INDETERMINATE; break;
	}
	taskbar->SetProgressState(hWnd, flags);
	taskbar->Release();
}
Ejemplo n.º 7
0
bool Taskbar::createInterface(void)
{
	if(s_data && (!s_data->ptbl))
	{
		const HRESULT hrComInit = CoInitialize(NULL);

		if((hrComInit != S_OK) && (hrComInit != S_FALSE))
		{
			qWarning("CoInitialize() has failed!");
			return false;
		}

		ITaskbarList3 *tmp = NULL;
		const HRESULT hrCreate = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&tmp));

		if(!SUCCEEDED(hrCreate))
		{
			qWarning("ITaskbarList3 interface could not be created!");
			CoUninitialize();
			return false;
		}

		const HRESULT hrInitTaskbar = tmp->HrInit();

		if(!SUCCEEDED(hrInitTaskbar))
		{
			qWarning("ITaskbarList3::HrInit() has failed!");
			RELEASE(tmp);
			CoUninitialize();
			return false;
		}

		s_data->ptbl = tmp;
		return true;
	}

	qWarning("Interface was already created!");
	return false;
}
Ejemplo n.º 8
-1
void SetProgressValEx(HWND hWnd, ULONGLONG Completed, ULONGLONG Total)
{
	ITaskbarList3 *taskbar;
	if(S_OK != CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&taskbar))
		return;
	taskbar->HrInit();
	taskbar->SetProgressValue(hWnd, Completed, Total);
	taskbar->Release();
}