本文整理汇总了C++中COptionUI::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ COptionUI::GetText方法的具体用法?C++ COptionUI::GetText怎么用?C++ COptionUI::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptionUI
的用法示例。
在下文中一共展示了COptionUI::GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Notify
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);
//.........这里部分代码省略.........