Programming/WINAPI

작업표시줄(Taskbar)에서 아이콘 제거하기

smok95 2018. 2. 9. 08:06
반응형



#include 
#include 
const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}};
const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}};
const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17}};
const GUID IID_ITaskList3 = {0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF}};

void ShowTaskbarIcon(HWND WindowHandle)
{
	ITaskbarList* TaskListPtr;
	CoInitialize(nullptr);
	long Result = !CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, reinterpret_cast(&TaskListPtr));
	if (Result) TaskListPtr->AddTab(WindowHandle);
	TaskListPtr->Release();
	CoUninitialize();
}

void HideTaskbarIcon(HWND WindowHandle)
{
	ITaskbarList* TaskListPtr;
	CoInitialize(nullptr);
	long Result = !CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, reinterpret_cast(&TaskListPtr));
	if (Result) TaskListPtr->DeleteTab(WindowHandle);
	TaskListPtr->Release();
	CoUninitialize();
}




반응형