이코드는 작업표시줄 우클릭-도구모음에서 체크 해놓았을때만 동작함.
억지로 체크 되게 하는것은 xp+ie6에서는 죽어도 안됨 ㅠㅠㅠㅠㅠㅠ
Vista에서는 CLSID_ITrayDeskBand 인가? 이걸로 하면 졸라쉬움..
1. 보이기
CoInitialize(NULL);
HRESULT hr;
CLSID CLSID_내꼬= { 0xa7287b11, 0xd0e8, 0x4b96, { 0x9b, 0x62, 0x69, 0xc8, 0xce, 0x5d, 0x59, 0xda } };
IBandSite * pBandSite;
hr = CoCreateInstance(CLSID_TrayBandSiteService,NULL, CLSCTX_SERVER,IID_IBandSite,(LPVOID *)&pBandSite);
if(SUCCEEDED(hr))
{
IDeskBand * pBand = 0;
DWORD bandID = 0;
int i = 0;
while(pBandSite->EnumBands(i, &bandID) == S_OK)
{
// Get the band object.
i++;
pBandSite->GetBandObject(bandID, IID_IDeskBand,(void **) &pBand);
IPersist * pPersist = 0;
if(SUCCEEDED(pBand->QueryInterface(IID_IPersist,(void**)&pPersist)))
{
CLSID clsid = CLSID_NULL;
pPersist->GetClassID(&clsid);
if (clsid == CLSID_내꼬)
{
// Found the band, so get its window handle.
pBandSite->SetBandState(bandID,BSSF_VISIBLE,UINT_MAX);
}
pPersist->Release();
}
pBand->Release();
}
pBandSite->Release();
}
CoUninitialize();
2. 숨기기
CoInitialize(NULL);
HRESULT hr;
CLSID CLSID_내꼬= { 0xa7287b11, 0xd0e8, 0x4b96, { 0x9b, 0x62, 0x69, 0xc8, 0xce, 0x5d, 0x59, 0xda } };
IBandSite * pBandSite;
hr = CoCreateInstance(CLSID_TrayBandSiteService,NULL, CLSCTX_SERVER,IID_IBandSite,(LPVOID *)&pBandSite);
if(SUCCEEDED(hr))
{
IDeskBand * pBand = 0;
DWORD bandID = 0;
int i = 0;
while(pBandSite->EnumBands(i, &bandID) == S_OK)
{
// Get the band object.
i++;
pBandSite->GetBandObject(bandID, IID_IDeskBand,(void **) &pBand);
IPersist * pPersist = 0;
if(SUCCEEDED(pBand->QueryInterface(IID_IPersist,(void**)&pPersist)))
{
CLSID clsid = CLSID_NULL;
pPersist->GetClassID(&clsid);
if (clsid == CLSID_내꼬)
{
// Found the band, so get its window handle.
pBandSite->SetBandState(bandID,BSSF_VISIBLE,0);
}
pPersist->Release();
}
pBand->Release();
}
pBandSite->Release();
}
CoUninitialize();