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


C++ CContainerUI类代码示例

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


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

示例1: OnTheEvent

bool CMyList::OnTheEvent (void* pParam)
{
	TEventUI* pEvent = (TEventUI*)pParam;
	CContainerUI* pContainer = NULL;

	if (pEvent->pSender == NULL) {
		return true;
	}


	if (_tcsicmp (pEvent->pSender->GetClass(), _T ("ContainerUI")) != 0) {
		pContainer = static_cast <CContainerUI*> (pEvent->pSender->GetParent());
	}
	else {
		pContainer = static_cast <CContainerUI*> (pEvent->pSender);
	}

	if (pContainer == NULL) {
		return true;
	}

	if (pEvent->Type == UIEVENT_MOUSEENTER) {
		if (pContainer->GetBkColor() != 0x1100FF00)
			pContainer->SetBkColor(0x1100FF00);
	}
	else if (pEvent->Type == UIEVENT_MOUSELEAVE) {
		if (pContainer->GetBkColor() != 0xFFFFFFFF)
			pContainer->SetBkColor(0xFFFFFFFF);
	}

	return true;
}
开发者ID:fmj1980,项目名称:duilib,代码行数:32,代码来源:MyList.cpp

示例2: InitProp

//初始化道具栏
void CRightFrame::InitProp()
{
	CContainerUI* pPropMainCtn = static_cast<CContainerUI*>(m_pm.FindControl("Prop_Ctn_Main"));

	if (!pPropMainCtn)
	{
		return;
	}
	RECT rc = {0,20,1,0};
	char szBuf[32] = {0};

	for (int i = 0; i < MAX_PROP_NUMS; ++i)
	{
		m_pPropBtn[i] = new CButtonUI();

		_stprintf(szBuf,"Prop_Btn_%d",i);
		m_pPropBtn[i]->SetName(szBuf);

		m_pPropBtn[i]->SetText("");
		m_pPropBtn[i]->SetTextColor(0xFFFFFFFF);
		m_pPropBtn[i]->SetAttribute("align","right");
		m_pPropBtn[i]->SetTextPadding(rc);

		m_pPropBtn[i]->SetFixedHeight(34);
		m_pPropBtn[i]->SetFixedWidth(34);
		m_pPropBtn[i]->SetFloat(true);
		m_pPropBtn[i]->SetTag(0);

		pPropMainCtn->Add(m_pPropBtn[i]);
	}

	return;
}
开发者ID:liuwanbing,项目名称:liuwanbing,代码行数:34,代码来源:RightFrame.cpp

示例3: ViCbAddCtrl

// BOOL ViCbAddCtrl(HANDLE hCtrl, HANDLE hParent)
SQInteger ViCbAddCtrl(HSQUIRRELVM v)
{
    SQInteger        nargs         = sq_gettop(v);
    SQInteger        hCtrl         = 0;
    SQInteger        hParent       = 0;
    CContainerUI*    pParentCtrl   = NULL;
    CScriptMgr*      pMgr          = NULL;
    CPaintManagerUI* pPM           = NULL;
    CControlUI*      pCtrl         = NULL;
    SQBool           bRet          = FALSE;

    if (!v || 2 + 1 != nargs) {goto _Exit_;}
    if (OT_INTEGER != sq_gettype(v, 2)) {goto _Exit_;}
    if (OT_INTEGER != sq_gettype(v, 3)) {goto _Exit_;}

    sq_getinteger(v, 2, &hCtrl);
    sq_getinteger(v, 3, &hParent);

    pCtrl = QiHwHandleToCtrl(hCtrl);
    pParentCtrl = (CContainerUI*)QiHwHandleToCtrl(hParent);
    if (!pCtrl) {goto _Exit_;}
    if (NULL == pParentCtrl) {
        pMgr = (CScriptMgr*)sq_getforeignptr(v);
        if (!pMgr) {goto _Exit_;}
        pPM = pMgr->GetManager();
        if (!pPM) {goto _Exit_;}
        pParentCtrl = (CContainerUI*)pPM->GetRoot();
    }
    if (!pParentCtrl || !pParentCtrl->IsContainer()) {goto _Exit_;}
    bRet = (SQBool)pParentCtrl->Add(pCtrl);

_Exit_:
    sq_pushbool(v, bRet);
    return 1;
}
开发者ID:eriser,项目名称:kdguigl,代码行数:36,代码来源:Scriptapi.cpp

示例4: cb

CTreeTab::CTreeTab(CPaintManagerUI* ppm)
{
	CDialogBuilder builder;
	CDialogBuilderCallbackEx cb (ppm);
	CContainerUI* pbtnTab = static_cast<CContainerUI*>(builder.Create(_T("tree.xml"), 0, &cb, ppm));
	if( pbtnTab ) {
		this->Add(pbtnTab);
	}
	else {
		this->RemoveAll();
		return;
	}

	CDuiTreeView* pTree1 = static_cast<CDuiTreeView*>(pbtnTab->FindSubControl(_T("Tree1")));
	pTree1->OnNotify += MakeDelegate(this,&CTreeTab::OnFolderChanged);
	if (pTree1) {
		pTree1->SetDepth(4);
		pTree1->SetExpandImage(_T("tree_expand.png"));
		CDuiTreeView::Node* pCategoryNode = NULL;
		CDuiTreeView::Node* pGameNode = NULL;
		CDuiTreeView::Node* pServerNode = NULL;
		CDuiTreeView::Node* pRoomNode = NULL;
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÍƼöÓÎÏ·"));
		for (int i = 0; i < 4; ++i)
		{
			pGameNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}ËÄÈ˶·µØÖ÷"), pCategoryNode);
			for (int i = 0; i < 3; ++i)
			{
				pServerNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·þÎñÆ÷"), pGameNode);
				for (int i = 0; i < 3; ++i)
				{
					pRoomNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·¿¼ä"), pServerNode);
				}
			}
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}×î½üÍæ¹ýµÄÓÎÏ·"));
		for (int i = 0; i < 2; ++i)
		{
			pTree1->AddNode(_T("Èýȱһ"), pCategoryNode);
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÆåÅÆÓÎÏ·"));
		for (int i = 0; i < 8; ++i)
		{
			pTree1->AddNode(_T("Ë«¿Û"), pCategoryNode);
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÐÝÏÐÓÎÏ·"));
		for (int i = 0; i < 8; ++i)
		{
			pTree1->AddNode(_T("·ÉÐÐÆå"), pCategoryNode);
		}
	}
}
开发者ID:fmj1980,项目名称:duilib,代码行数:52,代码来源:TreeTab.cpp

示例5: GetItemAt

bool CFriendsUI::SelectItem(int iIndex, bool bTakeFocus)
{
    if( iIndex == m_iCurSel ) return true;

    // We should first unselect the currently selected item
    if( m_iCurSel >= 0 ) {
        CControlUI* pControl = GetItemAt(m_iCurSel);
        if( pControl != NULL) {
            IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
            if( pListItem != NULL )
			{
				CListContainerElementUI* pFriendListItem = static_cast<CListContainerElementUI*>(pControl);
				Node* node = (Node*)pControl->GetTag();
				if ((pFriendListItem != NULL) && (node != NULL) && !node->folder())
				{
					pFriendListItem->SetFixedHeight(kFriendListItemNormalHeight);
					CContainerUI* pOperatorPannel = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pFriendListItem, kOperatorPannelControlName));
					if (pOperatorPannel != NULL)
					{
						pOperatorPannel->SetVisible(false);
					}
				}
				pListItem->Select(false);
			}
        }

        m_iCurSel = -1;
    }

    if( iIndex < 0 )
		return false;

	if (!__super::SelectItem(iIndex, bTakeFocus))
		return false;


	CControlUI* pControl = GetItemAt(m_iCurSel);
	if( pControl != NULL) {
		CListContainerElementUI* pFriendListItem = static_cast<CListContainerElementUI*>(pControl);
		Node* node = (Node*)pControl->GetTag();
		if ((pFriendListItem != NULL) && (node != NULL) && !node->folder())
		{
			pFriendListItem->SetFixedHeight(kFriendListItemSelectedHeight);
			CContainerUI* pOperatorPannel = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pFriendListItem, kOperatorPannelControlName));
			if (pOperatorPannel != NULL)
			{
				pOperatorPannel->SetVisible(true);
			}
		}
	}
	return true;
}
开发者ID:Amoystyle,项目名称:duilib,代码行数:52,代码来源:UIFriends.cpp

示例6: ASSERT

void CUIDesignerView::RedoUI(CControlUI* pControl, CControlUI* pParent)
{
	ASSERT(pControl && pParent);
	if(!pControl || !pParent)
		return;

	CContainerUI* pContainer = static_cast<CContainerUI*>(pParent->GetInterface(_T("Container")));
	ExtendedAttributes* pExtended = (ExtendedAttributes*)pContainer->GetTag();
	pContainer->Add(pControl);
	m_MultiTracker.Add(CreateTracker(pControl));
	InitUI(pControl, pExtended->nDepth + 1, TRUE);
	pContainer->SetPos(pContainer->GetPos());
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:13,代码来源:UIDesignerView.cpp

示例7: InEdit

void CBookClient::InEdit()
{
	m_bEdit = !m_bEdit;
	int num = this->GetCount();
	CContainerUI* pCtrl = NULL;

	for (int i = 0; i < num; ++i)
	{
		pCtrl = static_cast<CContainerUI*>(this->GetItemAt(i));
		pCtrl = static_cast<CContainerUI*>(pCtrl->FindSubControl(_T("btnbookdel")));
		ASSERT(pCtrl != NULL);
		pCtrl->SetVisible(m_bEdit);
	}
}
开发者ID:wyrover,项目名称:iume,代码行数:14,代码来源:BookClient.cpp

示例8: AddNode

bool CBookClient::AddNode(BOOK_INFO *item)
{
	if (item == NULL)	return false;

	BOOK_INFO *node	= new BOOK_INFO;
	node->strName	= item->strName;
	node->nImage	= item->nImage;
	node->strPath	= item->strPath;
	node->nBookmark	= item->nBookmark;

	CContainerUI* pDesk = NULL;
	if( !m_dlgBuilder.GetMarkup()->IsValid() )
	{
		pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create(_T("iBook.xml"), (UINT)0, NULL, &m_pm));
	}
	else
	{
		pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create((UINT)0, &m_pm));
	}

	if( pDesk != NULL )	
	{
		this->Add(pDesk);

		CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnBookEx")));
		CLabelUI *text = static_cast<CLabelUI*>(m_pm.FindSubControlByName(pDesk, _T("labelBookEx")));
		CButtonUI *btnEdit = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnbookdel")));
		if (btn == NULL || text == NULL || btnEdit == NULL)	return false;

		CDuiString strImage;
		strImage.Format(_T("book\\%02d.png"), node->nImage);
		btn->SetBkImage(strImage);
		text->SetText(node->strName);
		btnEdit->SetVisible(m_bEdit);

		pDesk->SetTag((UINT_PTR)node);
	}
	else
	{
		delete node;
		node = NULL;

		return false;
	}

	return true;
}
开发者ID:wyrover,项目名称:iume,代码行数:47,代码来源:BookClient.cpp

示例9: assert

bool CMainDialog::OnClickItem (void* pParam)
{
	TEventUI* pEvent = (TEventUI*)pParam;
	if (pEvent->Type == UIEVENT_BUTTONDOWN) {
		CComboUI* pcbx = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo2")));
		CEditUI* pedit = static_cast <CEditUI*> (m_pm.FindControl(_T ("ComboEdit")));
		assert (pedit);
		CContainerUI*  pItem = static_cast <CContainerUI*> (pcbx->GetItemAt (pEvent->pSender->GetTag()));
		pedit->SetText(pItem->GetItemAt(2)->GetText());
	}
	else if (pEvent->Type == UIEVENT_MOUSEENTER) {
		pEvent->pSender->SetBkColor(0xFF00FF00);
	}
	else if (pEvent->Type == UIEVENT_MOUSELEAVE) {
		pEvent->pSender->SetBkColor(0xFFFFFFFF);
	}
	return true;
}
开发者ID:yiminyangguang520,项目名称:duilib,代码行数:18,代码来源:MainDialog.cpp

示例10: GetParent

	//************************************
	// 函数名称: Invalidate
	// 返回类型: void
	// 函数说明: 
	//************************************
	void CTreeNodeUI::Invalidate()
	{
		if( !IsVisible() )
			return;

		if( GetParent() ) {
			CContainerUI* pParentContainer = static_cast<CContainerUI*>(GetParent()->GetInterface(_T("Container")));
			if( pParentContainer ) {
				RECT rc = pParentContainer->GetPos();
				RECT rcInset = pParentContainer->GetInset();
				rc.left += rcInset.left;
				rc.top += rcInset.top;
				rc.right -= rcInset.right;
				rc.bottom -= rcInset.bottom;
				CScrollBarUI* pVerticalScrollBar = pParentContainer->GetVerticalScrollBar();
				if( pVerticalScrollBar && pVerticalScrollBar->IsVisible() ) rc.right -= pVerticalScrollBar->GetFixedWidth();
				CScrollBarUI* pHorizontalScrollBar = pParentContainer->GetHorizontalScrollBar();
				if( pHorizontalScrollBar && pHorizontalScrollBar->IsVisible() ) rc.bottom -= pHorizontalScrollBar->GetFixedHeight();

				RECT invalidateRc = m_rcItem;
				if( !::IntersectRect(&invalidateRc, &m_rcItem, &rc) ) 
					return;

				CControlUI* pParent = GetParent();
				RECT rcTemp;
				RECT rcParent;
				while( pParent = pParent->GetParent() )
				{
					rcTemp = invalidateRc;
					rcParent = pParent->GetPos();
					if( !::IntersectRect(&invalidateRc, &rcTemp, &rcParent) ) 
						return;
				}

				if( m_pManager != NULL ) m_pManager->Invalidate(invalidateRc);
			}
			else {
				CContainerUI::Invalidate();
			}
		}
		else {
			CContainerUI::Invalidate();
		}
	}
开发者ID:goodgo,项目名称:TradeClient,代码行数:49,代码来源:UITreeView.cpp

示例11: EnumInstalledDriver

void MainFrame::EnumInstalledDriver()
{
	// 清空界面中list中显示的打印机列表
	CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
	if (pDriverList != NULL)
		pDriverList->RemoveAll();

	// 枚举本地计算机上所有安装的打印机驱动(实际使用时可以只枚举自家的打印机驱动)
	LPBYTE	lpBuffer = NULL;
	DWORD	dwNeeded = 0,dwReturned = 0;

	EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 1, NULL, 0, &dwNeeded, &dwReturned);
	if (dwNeeded == 0)
		return;

	lpBuffer = (LPBYTE)malloc(dwNeeded);
	if (lpBuffer == NULL)
		return;

	EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 1, lpBuffer, dwNeeded, &dwNeeded, &dwReturned);
	for (DWORD dwIndex = 0; (dwIndex < dwReturned) && (pDriverList != NULL); dwIndex++)
	{
		COptionUI* pDriver = new COptionUI();
		if (pDriver != NULL)
		{
			pDriver->ApplyAttributeList(_T("padding=\"15,0,0,0\" height=\"35\" textpadding=\"20,0,0,0\" align=\"left\" normalimage=\"res='124' restype='png' dest='0,10,15,25'\" hotimage=\"res='125' restype='png' dest='0,10,15,25'\" selectedimage=\"res='126' restype='png' dest='0,10,15,25'\""));
			pDriver->SetText(((PRINTER_INFO_1*)lpBuffer + dwIndex)->pName);
			pDriverList->Add(pDriver);
		}
	}

	LPTSTR lpDefaultPrinter;
	GetDefaultPrinter(NULL, &dwNeeded);

	lpDefaultPrinter = (LPTSTR)malloc(dwNeeded * sizeof(TCHAR));
	GetDefaultPrinter((LPTSTR)lpDefaultPrinter, &dwNeeded);

	free(lpDefaultPrinter);
	free(lpBuffer);
}
开发者ID:corytodd,项目名称:WindowsPrinterDriver,代码行数:40,代码来源:main_frame.cpp

示例12: defined

void ChatDialog::OnPrepare(TNotifyUI& msg)
{
	TCHAR szBuf[MAX_PATH] = {0};

	CControlUI* background = paint_manager_.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
#if defined(UNDER_WINCE)
		_stprintf(szBuf, _T("file='%s' corner='600,200,1,1'"), bgimage_.c_str());
#else
		_stprintf_s(szBuf, MAX_PATH - 1, _T("file='%s' corner='600,200,1,1'"), bgimage_.c_str());
#endif
		background->SetBkImage(szBuf);
		background->SetBkColor(bkcolor_);
	}

	CButtonUI* log_button = static_cast<CButtonUI*>(paint_manager_.FindControl(kLogoButtonControlName));
	if (log_button != NULL)
	{
#if defined(UNDER_WINCE)
		_stprintf(szBuf, _T("%s"), friend_.logo.c_str());
#else
		_stprintf_s(szBuf, MAX_PATH - 1, _T("%s"), friend_.logo.c_str());
#endif
		log_button->SetNormalImage(szBuf);
	}

	CControlUI* nick_name = paint_manager_.FindControl(kNickNameControlName);
	if (nick_name != NULL)
		nick_name->SetText(friend_.nick_name.c_str());

	CControlUI* desciption = paint_manager_.FindControl(kDescriptionControlName);
	if (desciption != NULL)
		desciption->SetText(friend_.description.c_str());

	CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName));
	if (pFontbar != NULL)
		pFontbar->SetVisible(!pFontbar->IsVisible());
}
开发者ID:hxf829,项目名称:duilibtest,代码行数:39,代码来源:chat_dialog.cpp

示例13: Init

void CMyList::Init(CPaintManagerUI* ppm)
{
	CDialogBuilder builder;
	CContainerUI* pList = static_cast<CContainerUI*>(builder.Create(_T("mylist.xml"), 0, NULL, ppm));
	if( pList != NULL ) {
		for(int i = 0; i < 100; ++i) 
		{
			if( pList == NULL ) pList = static_cast<CContainerUI*>(builder.Create());
			if( pList != NULL ) {
				this->Add(pList);
				TCHAR indexBuffer[16];
				CDuiString strIndexString = _T("- ");
				strIndexString += _itot(i+1, indexBuffer, 10);
				strIndexString += _T(" -");
				pList->GetItemAt(0)->SetText(strIndexString);

				CComboUI* pCombo = static_cast <CComboUI*> (pList->GetItemAt(1));
				if (pCombo != NULL) {
					for (int j = 0; j < 3; ++j) {
						CListLabelElementUI* pComboItem = new CListLabelElementUI;
						pComboItem->SetText("xxx");
						pCombo->Add(pComboItem);
					}
				}
				pList->GetItemAt(0)->OnEvent += MakeDelegate (this, &CMyList::OnTheEvent);
				pList->GetItemAt(1)->OnEvent += MakeDelegate (this, &CMyList::OnTheEvent);
				pList->GetItemAt(2)->OnEvent += MakeDelegate (this, &CMyList::OnTheEvent);
				pList->OnEvent += MakeDelegate (this, &CMyList::OnTheEvent);
				pList = NULL;
			}
			else {
				this->RemoveAll();
				return;
			}
		}
	}
}
开发者ID:fmj1980,项目名称:duilib,代码行数:37,代码来源:MyList.cpp

示例14: PasteUI

void CUIDesignerView::PasteUI(LPCTSTR xml)
{
	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(xml, (UINT)0, NULL, m_LayoutManager.GetManager());
	if(pRoot)
	{
		CControlUI* pParent = m_MultiTracker.GetFocused();
		if(pParent->GetInterface(_T("Container")) == NULL)
			pParent = pParent->GetParent();
		if(pParent == NULL)
			pParent = m_LayoutManager.GetForm();

		m_MultiTracker.RemoveAll();
		CContainerUI* pContainer = static_cast<CContainerUI*>(pParent->GetInterface(_T("Container")));
		CContainerUI* pRootContainer = static_cast<CContainerUI*>(pRoot->GetInterface(_T("Container")));
		ExtendedAttributes* pExtended = (ExtendedAttributes*)pContainer->GetTag();
		for(int i=0; i<pRootContainer->GetCount(); i++)
		{
			CControlUI* pControl = pRootContainer->GetItemAt(i);
			if(pControl->IsFloat())
			{
				SIZE sz = pControl->GetFixedXY();
				sz.cx += COPY_OFFSET_XY;
				sz.cy += COPY_OFFSET_XY;
				pControl->SetFixedXY(sz);
			}
			pContainer->Add(pControl);
			m_MultiTracker.Add(CreateTracker(pControl));
			InitUI(pControl, pExtended->nDepth + 1);
		}
		CArray<CControlUI*,CControlUI*> arrSelected;
		m_MultiTracker.GetSelected(arrSelected);
		m_UICommandHistory.Begin(arrSelected, actionAdd);
		m_UICommandHistory.End();

		pContainer->SetPos(pContainer->GetPos());

		pRootContainer->SetAutoDestroy(false);
		delete pRootContainer;
		this->GetDocument()->SetModifiedFlag();
	}
}
开发者ID:the7day,项目名称:py-ui4win,代码行数:42,代码来源:UIDesignerView.cpp

示例15: OnPrepare

void MainFrame::Notify(TNotifyUI& msg)
{
	if (_tcsicmp(msg.sType, kWindowInit) == 0)
	{
		OnPrepare(msg);
	}
	else if (_tcsicmp(msg.sType, kClick) == 0)
	{
		if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0 || _tcsicmp(msg.pSender->GetName(), kCancelButtonControlName) == 0)
		{
			OnExit(msg);
		}
		else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_MINIMIZE);
#else
			SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_MAXIMIZE);
			CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
			if( pControl ) pControl->SetVisible(false);
			pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
			if( pControl ) pControl->SetVisible(true);
#else
			SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_RESTORE);
			CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
			if( pControl ) pControl->SetVisible(true);
			pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
			if( pControl ) pControl->SetVisible(false);
#else
			SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), _T("select_all_btn")) == 0)
		{
			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if (pDriver != NULL)
					pDriver->Selected(true);
			}
		}
		else if (_tcsicmp(msg.pSender->GetName(), _T("uninstall_btn")) == 0)
		{
			vector<tString> deleted_printer_driver;
			DWORD dwError = 0;
			TCHAR szBuf[MAX_PATH] = {0};

			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if ((pDriver != NULL) && pDriver->IsSelected())
				{
					// 涉及到的API: DeletePrinter DeletePrinterDriver
					HANDLE hPrinter = NULL;
					_stprintf_s(szBuf, MAX_PATH - 1, pDriver->GetText().GetData());
					PRINTER_DEFAULTS PrtDefault = {NULL, NULL, PRINTER_ALL_ACCESS};
					OpenPrinter(szBuf, &hPrinter, &PrtDefault);
					if (hPrinter != NULL)
					{
						DWORD dwNeeded = 0;
						GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
						LPBYTE lpBuffer = (LPBYTE)malloc(dwNeeded);
						if (lpBuffer != NULL)
						{
							GetPrinter(hPrinter, 2, lpBuffer, dwNeeded, &dwNeeded);

							DeletePrinter(hPrinter);

							dwError = GetLastError();

							vector<tString>::const_iterator citer = find(deleted_printer_driver.begin(), deleted_printer_driver.end(), ((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							if (citer == deleted_printer_driver.end())
							{
								deleted_printer_driver.push_back(((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							}

							ClosePrinter(hPrinter);
							free(lpBuffer);
						}
					}
				}
			}
			for (vector<tString>::const_iterator citer = deleted_printer_driver.begin(); citer != deleted_printer_driver.end(); ++citer)
			{
				_stprintf_s(szBuf, MAX_PATH - 1, citer->c_str());
				DeletePrinterDriver(NULL, NULL, szBuf);
//.........这里部分代码省略.........
开发者ID:corytodd,项目名称:WindowsPrinterDriver,代码行数:101,代码来源:main_frame.cpp


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