Example #1
0
BOOL TabCtrl_SwapItems(HWND hTabCtrl, int iItem1, int iItem2)
{
	TCITEM tcItem;
	TCHAR szText1[512];
	tcItem.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
	tcItem.pszText = szText1;
	tcItem.cchTextMax = SIZEOF_ARRAY(szText1);
	BOOL bRet = TabCtrl_GetItem(hTabCtrl, iItem1, &tcItem);

	if(!bRet)
	{
		return FALSE;
	}

	LPARAM lParam1;
	int iImage1;
	lParam1 = tcItem.lParam;
	iImage1 = tcItem.iImage;

	TCHAR szText2[512];
	tcItem.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
	tcItem.pszText = szText2;
	tcItem.cchTextMax = SIZEOF_ARRAY(szText2);

	bRet = TabCtrl_GetItem(hTabCtrl, iItem2, &tcItem);

	if(!bRet)
	{
		return FALSE;
	}

	LPARAM lParam2;
	int iImage2;
	lParam2 = tcItem.lParam;
	iImage2 = tcItem.iImage;

	tcItem.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
	tcItem.pszText = szText1;
	tcItem.lParam = lParam1;
	tcItem.iImage = iImage1;
	bRet = TabCtrl_SetItem(hTabCtrl, iItem2, &tcItem);

	if(!bRet)
	{
		return FALSE;
	}

	tcItem.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
	tcItem.pszText = szText2;
	tcItem.lParam = lParam2;
	tcItem.iImage = iImage2;
	bRet = TabCtrl_SetItem(hTabCtrl, iItem1, &tcItem);

	if(!bRet)
	{
		return FALSE;
	}

	return TRUE;
}
Example #2
0
///////////////////////////////////////////////
// Tab control has changed : hide/show controls
LRESULT TR_ChangeTabControl (HWND hDlgWnd)
{
HWND   hTabWnd = GetDlgItem (hDlgWnd, IDC_TAB_OPTION);
DWORD  nCurOnglet = TabCtrl_GetCurSel (hTabWnd);
DWORD  Ark;
DWORD  TabMask;
TC_ITEM TabCtrlItem;

 // get the selected tab id
 if (nCurOnglet != (DWORD)-1)
   {
          TabCtrlItem.mask = TCIF_PARAM   ;
          TabCtrl_GetItem (hTabWnd, nCurOnglet, & TabCtrlItem);
          TabMask = MakeMask (TabCtrlItem.lParam);
   }
  else    TabMask = TAB_NONE;

 // according to TabMask and tResize table hide/display controls
 for (Ark=0 ; Ark<SizeOfTab(tResize) ; Ark++)
        ShowWindow (GetDlgItem (hDlgWnd, tResize[Ark].idCtrl),
                    (tResize[Ark].mView & TabMask) ? SW_SHOW : SW_HIDE);

  // DHCP tab has been selected : display the settings
  if (TabMask == TAB_DHCP_SERVER)
  {
	 Gui_LoadDHCPConfig (hDlgWnd);
  }

return TabCtrlItem.lParam ;
} // ChangeTabControl
Example #3
0
HWND Main_CreateTabDialog (HWND hTab, size_t iTab)
{
   HWND hDlg = NULL;
   LPTSTR psz = NULL;

   TC_ITEM Item;
   memset (&Item, 0x00, sizeof(Item));
   Item.mask = TCIF_PARAM;
   if (TabCtrl_GetItem (hTab, iTab, &Item))
      {
      psz = (LPTSTR)(Item.lParam);
      }

   if (psz == dwTABPARAM_ADVANCED)    // Advanced tab
      {
      hDlg = ModelessDialog (IDD_TAB_ADVANCED, hTab, (DLGPROC)Advanced_DlgProc);
      }
   else if (psz == dwTABPARAM_MOUNT)  // Mount Points tab
      {
      hDlg = ModelessDialog (IDD_TAB_MOUNT, hTab, (DLGPROC)Mount_DlgProc);
      }
   else if (ISCELLTAB(psz) && !*psz)  // No Creds tab
      {
      hDlg = ModelessDialogParam (IDD_TAB_NOCREDS, hTab, (DLGPROC)Creds_DlgProc, (LPARAM)psz);
      }
   else if (ISCELLTAB(psz) && *psz)   // Creds tab for a particular cell
      {
      hDlg = ModelessDialogParam (IDD_TAB_CREDS, hTab, (DLGPROC)Creds_DlgProc, (LPARAM)psz);
      }

   return hDlg;
}
void CContainer::OnRenameTabInit(HWND hDlg)
{
	HWND	hEditName;
	TCITEM	tcItem;

	hEditName = GetDlgItem(hDlg,IDC_RENAMETAB_NEWTABNAME);

	tcItem.mask			= TCIF_PARAM;
	TabCtrl_GetItem(m_hTabCtrl,g_iTab,&tcItem);

	SetWindowText(hEditName,m_TabInfo[(int)tcItem.lParam].szName);

	g_EditNameEnabled = m_TabInfo[(int)tcItem.lParam].bUseCustomName;

	/* When this dialog is opened, the 'custom name' option will
	be selected by default (whether or not that is the actual
	option that is currently in effect). */
	CheckDlgButton(hDlg,IDC_RENAMETAB_USECUSTOMNAME,BST_CHECKED);

	EnableWindow(hEditName,TRUE);

	/* Select all the text in the name edit control. */
	SendMessage(hEditName,EM_SETSEL,0,-1);

	/* Focus on the name edit control. */
	SetFocus(hEditName);
}
Example #5
0
int TabToFront(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));

	if(Index == -1)
		Index = TabCtrl_GetCurSel(TabWindow);

	if(Index == -1)
		Index = 0;

	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_PARAM;

	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		ShowWindow(static_cast<HWND>(GetProp(TabWindow, PropName)), SW_HIDE);
		SetWindowPos(reinterpret_cast<HWND>(TabData.lParam), HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
		SetProp(TabWindow, PropName, reinterpret_cast<HANDLE>(TabData.lParam));
		TabCtrl_SetCurSel(TabWindow, Index);
		return Index;
	}
	return -1;
}
static struct MessageWindowData * GetChildFromTab(HWND hwndTabs, int tabId)
{
	TCITEM tci;
	tci.mask = TCIF_PARAM;
	TabCtrl_GetItem(hwndTabs, tabId, &tci);
	return (struct MessageWindowData *) tci.lParam;
}
void Explorerplusplus::SetTabIcon(int iTabId)
{
	LPITEMIDLIST pidl = NULL;
	TCITEM tcItem;
	int nTabs;
	int i = 0;

	pidl = m_pShellBrowser[iTabId]->QueryCurrentDirectoryIdl();

	nTabs = TabCtrl_GetItemCount(m_hTabCtrl);

	for(i = 0;i < nTabs;i++)
	{
		tcItem.mask = TCIF_PARAM;
		TabCtrl_GetItem(m_hTabCtrl,i,&tcItem);

		if((int)tcItem.lParam == iTabId)
		{
			SetTabIcon(i,iTabId,pidl);
			break;
		}
	}

	CoTaskMemFree(pidl);
}
Example #8
0
static void
show_tab_panel(HWND hwnd,
               khui_config_node node,
               HWND hw_tab,
               int idx,
               BOOL show) {
    TCITEM tci;
    HWND hw;
    HWND hw_target;
    HWND hw_firstctl;
    RECT r;
    RECT rref;
    khui_config_node_reg reg;

    ZeroMemory(&tci, sizeof(tci));

    tci.mask = TCIF_PARAM;
    TabCtrl_GetItem(hw_tab,
                    idx,
                    &tci);

#ifdef DEBUG
    assert(tci.lParam);
#endif
    khui_cfg_get_reg((khui_config_node) tci.lParam, &reg);
    if (reg.flags & KHUI_CNFLAG_PLURAL)
        hw = khui_cfg_get_hwnd_inst((khui_config_node) tci.lParam,
                                    node);
    else
        hw = khui_cfg_get_hwnd((khui_config_node) tci.lParam);
#ifdef DEBUG
    assert(hw);
#endif

    if (!show) {
        ShowWindow(hw, SW_HIDE);
        return;
    }

    hw_target = GetDlgItem(hwnd, IDC_CFG_TARGET);
#ifdef DEBUG
    assert(hw_target);
#endif
    GetWindowRect(hwnd, &rref);
    GetWindowRect(hw_target, &r);

    OffsetRect(&r, -rref.left, -rref.top);

    SetWindowPos(hw,
                 hw_tab,
                 r.left, r.top,
                 r.right - r.left, r.bottom - r.top,
                 SWP_NOACTIVATE | SWP_NOOWNERZORDER |
                 SWP_SHOWWINDOW);

    hw_firstctl = GetNextDlgTabItem(hw, NULL, FALSE);
    if (hw_firstctl) {
        SetFocus(hw_firstctl);
    }
}
Example #9
0
//重绘选项卡
void SiTabCtl_OnDrawItem(DRAWITEMSTRUCT* item)
{
	HBRUSH hBrush;
	TCITEM tci;
	char text[SI_BUF_SIZE];
	int type;

	memset(&tci,0,sizeof(TCITEM));
	tci.mask = TCIF_TEXT | TCIF_STATE;
	tci.pszText = (LPSTR)text;
	tci.cchTextMax = SI_BUF_SIZE;
	TabCtrl_GetItem(hwnd_tab_ctl,item->itemID,&tci);

	type = GetColorIndex(text);
	//创建颜色为hdc(窗口矩形)背景色的实画刷
	hBrush = CreateSolidBrush(color_table[type]);
	if(SiTabCtl_GetCurItem() == item->itemID)
	{
		hBrush = CreateSolidBrush(RGB(255,0,0));
	}
    //SetTextColor(lpDrawItem->hDC, RGB(0, 0, 255));
    //FrameRect(item->hDC,&item->rcItem,hBrush);
    FillRect(item->hDC,&item->rcItem,hBrush);
    DeleteObject(hBrush);
    SetBkMode(item->hDC,TRANSPARENT);
    DrawText(item->hDC,text,strlen(text),&item->rcItem,DT_CENTER|DT_LEFT|DT_VCENTER|DT_SINGLELINE);
}
LRESULT CALLBACK RefreshRSP_RegProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
	int nSel;
	TC_ITEM item;

	switch( uMsg ) {
	case WM_PAINT:
		nSel = TabCtrl_GetCurSel( hTab );
		if ( nSel > -1 ) {
			item.mask = TCIF_PARAM;
			TabCtrl_GetItem( hTab, nSel, &item );
			switch( item.lParam ) {
			case GeneralPurpose:
				PaintRSP_GPRPanel (hWnd);
				break;
			case ControlProcessor0:
				PaintRSP_CP0Panel (hWnd);
				break;
			case HiddenRegisters:
				PaintRSP_HiddenPanel (hWnd);
				break;
			case Vector1:
				PaintRSP_Vector1_Panel (hWnd);
				break;
			case Vector2:
				PaintRSP_Vector2_Panel (hWnd);
				break;
			}

		}
		break;
	default:
		return( (*RefreshProc)(hWnd, uMsg, wParam, lParam) );
	}
	return( FALSE );
}
static BOOL flags_HandleTabSwitch( HWND hDlg, LPNMHDR nmhdr )
{
	TCITEM		tcitem;
	HWND		edit;

	int i = TabCtrl_GetCurSel( nmhdr->hwndFrom );
	tcitem.mask = TCIF_PARAM;
	TabCtrl_GetItem( nmhdr->hwndFrom, i, &tcitem );
	edit = (HWND) tcitem.lParam;

	// The tab is right about to switch. Hide the current tab pane.
	if ( nmhdr->code == TCN_SELCHANGING )
	{
		ShowWindow( edit, SW_HIDE );
		SetWindowLongPtr( hDlg, DWLP_MSGRESULT, FALSE );
		return TRUE;
	}
	// The tab has just switched. Show the new tab pane.
	else if ( nmhdr->code == TCN_SELCHANGE )
	{
		ShowWindow ( edit, SW_SHOW );
		return TRUE;
	}
	else
		return FALSE;
}
Example #12
0
void mxTab_resizeChild (HWND hwnd)
{
	TC_ITEM ti;

	int index = TabCtrl_GetCurSel (hwnd);
	if (index >= 0)
	{
		ti.mask = TCIF_PARAM;
		TabCtrl_GetItem (hwnd, index, &ti);
		mxWidget *widget = (mxWidget *) ti.lParam;
		if (widget)
		{
			RECT rc, rc2;

			GetWindowRect (hwnd, &rc);
			ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.left);
			ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.right);

			TabCtrl_GetItemRect (hwnd, index, &rc2);

			int ex = GetSystemMetrics (SM_CXEDGE);
			int ey = GetSystemMetrics (SM_CYEDGE);
			rc.top += (rc2.bottom - rc2.top) + 3 * ey;
			rc.left += 2 * ex;
			rc.right -= 2 * ex;
			rc.bottom -= 2 * ey;
			HDWP hdwp = BeginDeferWindowPos (2);
			DeferWindowPos (hdwp, hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
			DeferWindowPos (hdwp, (HWND) widget->getHandle (), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
			EndDeferWindowPos (hdwp);
		}
	}
}
Example #13
0
/**
 * popuplate the side bar with all sessions inside the current window. Information
 * is gathered from the tab control, which remains active (but invisible) when the
 * switch bar is in use.
 *
 * This is needed when the user switches from tabs to a switchbar layout while a
 * window is open.
 */
void CSideBar::populateAll()
{
	HWND	hwndTab = ::GetDlgItem(m_pContainer->hwnd, IDC_MSGTABS);
	if (hwndTab == NULL)
		return;

	int iItems = (int)TabCtrl_GetItemCount(hwndTab);

	TCITEM item = { 0 };
	item.mask = TCIF_PARAM;

	m_iTopButtons = 0;

	for (int i = 0; i < iItems; i++) {
		TabCtrl_GetItem(hwndTab, i, &item);
		if (item.lParam == 0 || !IsWindow((HWND)item.lParam))
			continue;

		TWindowData *dat = (TWindowData*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
		if (dat == NULL)
			continue;

		CSideBarButton *b_item = findSession(dat);
		if (b_item == NULL)
			addSession(dat, i);
		else {
			b_item->setLayout(m_currentLayout);
			if (m_dwFlags & SIDEBARLAYOUT_VERTICALORIENTATION) {
				b_item->measureItem();
				m_topHeight += b_item->getHeight() + 1;
			}
			else m_topHeight += m_elementHeight + 1;
		}
	}
}
Example #14
0
//单击选项卡
void SiTabCtl_OnLButtonClk(void)
{
	int rtv;
	int idx = SiTabCtl_GetCurItem();
	int count = SiTabCtl_GetItemCount();
	if(idx != count)
		return;
	if(count == 0)
		return;

	rtv = MessageBox(hwnd_tab_ctl,"是否关闭所有标签?","sitab plugin by Red_angelX",MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2);
	if(rtv == IDCANCEL)
		return;

	while(count > 0)
	{
		HWND hwnd;
		TCITEM tci;
		memset(&tci,0,sizeof(TCITEM));
		tci.mask = TCIF_TEXT | TCIF_PARAM;
		TabCtrl_GetItem(hwnd_tab_ctl,count-1,&tci);
		hwnd = (HWND)tci.lParam;

		SendMessage(hwnd,WM_SYSCOMMAND,SC_CLOSE,0);
		count--;
	}
}
Example #15
0
//
//	Called when the dockpanel receivees a WM_NOTIFY from one of its child-windows
//  i.e. either the TabView, or one of the DOCKWND's
//
LRESULT DockPanel_OnNotify(DOCKPANEL *dpp, WPARAM wParam, NMHDR *hdr)
{
	// notification message from the TabView
	if(hdr->hwndFrom == dpp->hwndTabView)
	{
		TCITEM tci = { TCIF_PARAM };
		DOCKWND *dwp;

		// get the active selection
		int iItem = TabCtrl_GetCurSel(dpp->hwndTabView);

		// every tab-item's lParam is a dockwindow-ID
		TabCtrl_GetItem(dpp->hwndTabView, iItem, &tci);

		switch(hdr->code)
		{
		case TCN_SELCHANGE:
			// show the appropriate DOCKWND
			DockWnd_Show(dpp->hwndMain, (UINT)tci.lParam, TRUE);
			break;

		case TCN_CLOSE:
			// hide the DOCKWND
			DockWnd_Show(dpp->hwndMain, (UINT)tci.lParam, FALSE);

			// delete the tab
			TabCtrl_DeleteItem(dpp->hwndTabView, iItem);
			break;

		case TCN_MOUSELEAVE:
			// the mouse has moved outside of the tab,
			// whilst being clicked - so we need to drag
			// the tab off into its own floating dock-window
			dwp = DOCKWNDFromId(dpp->hwndMain, (UINT)tci.lParam);
			
			if(dpp->WndListHead->flink == dwp && dpp->WndListTail->blink == dwp)
			{
				// if this is the last tab, then do a normal undock
				SendMessage(dpp->hwndTabView, WM_CANCELMODE, 0, 0);

				dpp->fUndockNextMsg = TRUE;
				DragOff(dpp);
			}
			else
			{
				// otherwise detach the tab and float it in a new DOCKPANEL
				UndockAndRemoveTab(dpp, (UINT)tci.lParam);
			}
			break;
		}

		return 0;
	}
	else
	{
		// forward it straight on
		return SendMessage(dpp->hwndMain, WM_NOTIFY, wParam, (LPARAM)hdr);
	}
}
CShellBrowser *CTabContainer::GetBrowserForTab(int Index)
{
	TCITEM tcItem;
	tcItem.mask = TCIF_PARAM;
	TabCtrl_GetItem(m_hTabCtrl,Index,&tcItem);

	return m_pShellBrowsers[tcItem.lParam];
}
Example #17
0
std::wstring Explorerplusplus::GetTabName(int iTab) const
{
	TCITEM tcItem;
	tcItem.mask = TCIF_PARAM;
	TabCtrl_GetItem(m_hTabCtrl,iTab,&tcItem);

	return std::wstring(m_TabInfo[static_cast<int>(tcItem.lParam)].szName);
}
Example #18
0
// Gets the TabData pointer from the lParam member of the TCITEM structure of the tab.
TabData *GetTabData(WindowInfo *win, int tabIndex)
{
    TCITEM tcs;
    tcs.mask = TCIF_PARAM;
    if (TabCtrl_GetItem(win->hwndTabBar, tabIndex, &tcs))
        return (TabData *)tcs.lParam;
    return NULL;
}
Example #19
0
LPARAM GetTabParam (HWND hTab, int iTab)
{
   TC_ITEM Item;
   memset (&Item, 0x00, sizeof(Item));
   Item.mask = TCIF_PARAM;
   if (!TabCtrl_GetItem (hTab, iTab, &Item))
      return NULL;
   return Item.lParam;
}
Example #20
0
// Get the item image
int wxTabCtrl::GetItemImage(int item) const
{
    TC_ITEM tcItem;
    tcItem.mask = TCIF_IMAGE;

    if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) )
        return tcItem.iImage;
    else
        return -1;
}
Example #21
0
// Get the item data
void* wxTabCtrl::GetItemData(int item) const
{
    TC_ITEM tcItem;
    tcItem.mask = TCIF_PARAM;

    if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) )
        return (void*) tcItem.lParam;
    else
        return 0;
}
Example #22
0
int wxNotebook::GetPageImage(size_t nPage) const
{
    wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );

    TC_ITEM tcItem;
    tcItem.mask = TCIF_IMAGE;

    return TabCtrl_GetItem(GetHwnd(), nPage, &tcItem) ? tcItem.iImage
                                                      : wxNOT_FOUND;
}
Example #23
0
//标签选中改变
void SiTabCtl_OnSelChange(void)
{
	HWND hwnd;
	int idx = SiTabCtl_GetCurItem();
	TCITEM tci;
	memset(&tci,0,sizeof(TCITEM));
	tci.mask = TCIF_TEXT | TCIF_PARAM;
	TabCtrl_GetItem(hwnd_tab_ctl,idx,&tci);
	hwnd = (HWND)tci.lParam;
	SendMessage(GetParent(hwnd),WM_MDIACTIVATE,(WPARAM)hwnd,0);
}
Example #24
0
//设置Item文字
void SiTabCtl_SetItemText(HWND hwnd,char* text)
{
	int idx = SiTabCtl_FindItem(hwnd);
	if(idx == -1)
		return;
	TCITEM tci;
	memset(&tci,0,sizeof(TCITEM));
	tci.mask = TCIF_TEXT | TCIF_PARAM;
	TabCtrl_GetItem(hwnd_tab_ctl,idx,&tci);

	tci.pszText = (LPSTR)text;
	TabCtrl_SetItem(hwnd_tab_ctl,idx,&tci);
}
Example #25
0
void CTabsDlg::HandleUndock()
{
	TCITEM item;
	item.mask = TCIF_PARAM;

	int curSel = TabCtrl_GetCurSel(m_Tabs.GetSafeHwnd());

	TabCtrl_GetItem(m_Tabs.GetSafeHwnd() , curSel , &item);

	DockedWindowInfo *info = (DockedWindowInfo *)item.lParam;
	ASSERT(info);

	DockWindow(info->m_ID , false);
}
Example #26
0
bool CTabPanelWin::GetTabText(int nTabIdx, wchar_t* pszText, int cchTextMax)
{
	bool bRc = false;
	TCITEM item = {TCIF_TEXT};
	item.pszText = pszText;
	item.cchTextMax = cchTextMax;

	pszText[0] = 0;

	if (TabCtrl_GetItem(mh_Tabbar, nTabIdx, &item))
		bRc = true;

	return bRc;
}
Example #27
0
// Get the item text
wxString wxTabCtrl::GetItemText(int item) const
{
    wxChar buf[256];
    wxString str(wxEmptyString);
    TC_ITEM tcItem;
    tcItem.mask = TCIF_TEXT;
    tcItem.pszText = buf;
    tcItem.cchTextMax = 256;

    if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) )
        str = tcItem.pszText;

    return str;
}
Example #28
0
HWND GetTabWindow(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));
	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_PARAM;
	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		return reinterpret_cast<HWND>(TabData.lParam);
	}
	return NULL; 
}
Example #29
0
//WM_NOTIFY:
void TfrmMain::wmNotify(WPARAM wParam, LPARAM lParam) {
    switch(((LPNMHDR)lParam)->idFrom) {
    case IDC_CAPTURETAB:				//TabControl IDC_CAPTURETAB
        switch (((LPNMHDR)lParam)->code) {
        //    HWND hwndFrom;	= member is handle to the tab control
        //    UINT_PTR idFrom;	= member is the child window identifier of the tab control.
        //    UINT code;		= member is TCN_SELCHANGE
        case TCN_SELCHANGING:
        {
            TAB_INFO itab;
            ZeroMemory(&itab, sizeof(itab));
            itab.tcih.mask = TCIF_PARAM;
            TabCtrl_GetItem(m_hwndTab,TabCtrl_GetCurSel(m_hwndTab),&itab);
            ShowWindow(itab.hwndTabPage,SW_HIDE);
            m_hwndTabPage = NULL;
        }
        break;

        case TCN_SELCHANGE:
        {
            TAB_INFO itab;
            ZeroMemory(&itab, sizeof(itab));
            itab.tcih.mask = TCIF_PARAM;
            m_opt_tabCapture = TabCtrl_GetCurSel(m_hwndTab);
            TabCtrl_GetItem(m_hwndTab, m_opt_tabCapture, &itab);
            ShowWindow(itab.hwndTabPage, SW_SHOW);
            m_hwndTabPage = itab.hwndTabPage;
        }
        break;
        default:
            break;
        }
        break;
    default:
        break;
    }
}
/* Sets a tabs icon. Normally, this icon
is the folders icon, however if the tab
is locked, the icon will be a lock. */
void Explorerplusplus::SetTabIcon(int iIndex,int iTabId,LPITEMIDLIST pidlDirectory)
{
	TCITEM			tcItem;
	SHFILEINFO		shfi;
	ICONINFO		IconInfo;
	int				iImage;
	int				iRemoveImage;

	/* If the tab is locked, use a lock icon. */
	if(m_TabInfo[iTabId].bAddressLocked || m_TabInfo[iTabId].bLocked)
	{
		iImage = TAB_ICON_LOCK_INDEX;
	}
	else
	{
		SHGetFileInfo((LPCTSTR)pidlDirectory,0,&shfi,sizeof(shfi),
			SHGFI_PIDL|SHGFI_ICON|SHGFI_SMALLICON);

		/* TODO: The proxy icon may also be the lock icon, if
		the tab is locked. */
		SetTabProxyIcon(iTabId,shfi.hIcon);

		GetIconInfo(shfi.hIcon,&IconInfo);
		iImage = ImageList_Add(TabCtrl_GetImageList(m_hTabCtrl),
			IconInfo.hbmColor,IconInfo.hbmMask);

		DeleteObject(IconInfo.hbmColor);
		DeleteObject(IconInfo.hbmMask);
		DestroyIcon(shfi.hIcon);
	}

	/* Get the index of the current image. This image
	will be removed after the new image is set. */
	tcItem.mask		= TCIF_IMAGE;
	TabCtrl_GetItem(m_hTabCtrl,iIndex,&tcItem);

	iRemoveImage = tcItem.iImage;

	/* Set the new image. */
	tcItem.mask		= TCIF_IMAGE;
	tcItem.iImage	= iImage;
	TabCtrl_SetItem(m_hTabCtrl,iIndex,&tcItem);

	if(iRemoveImage != TAB_ICON_LOCK_INDEX)
	{
		/* Remove the old image. */
		TabCtrl_RemoveImage(m_hTabCtrl,iRemoveImage);
	}
}