本文整理汇总了C++中StrApp::Chars方法的典型用法代码示例。如果您正苦于以下问题:C++ StrApp::Chars方法的具体用法?C++ StrApp::Chars怎么用?C++ StrApp::Chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StrApp
的用法示例。
在下文中一共展示了StrApp::Chars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDialogValues
/*----------------------------------------------------------------------------------------------
Set the values for the dialog controls based
----------------------------------------------------------------------------------------------*/
void TeStylesDlg::SetDialogValues()
{
// Fill list combobox.
StrApp staTemp;
::SendMessage(m_hwndList, CB_RESETCONTENT, 0, 0);
staTemp.Load(kstidTesdListBasic);
::SendMessage(m_hwndList, CB_ADDSTRING, 0, (LPARAM)staTemp.Chars()); // 0
staTemp.Load(kstidTesdListAll);
::SendMessage(m_hwndList, CB_ADDSTRING, 0, (LPARAM)staTemp.Chars()); // 1
staTemp.Load(kstidTesdListCustom);
::SendMessage(m_hwndList, CB_ADDSTRING, 0, (LPARAM)staTemp.Chars()); // 2
// Select the value in the combo box that represents the selected level.
int nSelect;
if (m_nCustomStyleLevel == 0)
nSelect = ksttBasic;
else if (m_nCustomStyleLevel > 10)
nSelect = ksttAll;
else
nSelect = ksttCustom;
::SendMessage(m_hwndList, CB_SETCURSEL, nSelect, 0);
SuperClass::SetDialogValues();
}
示例2: AppendUnderlineInfo
// Append to strDesc appropriate info about underline if any.
void AppendUnderlineInfo(StrApp & strDesc, COLORREF clrUnder, int unt, bool & fFirst)
{
StrApp strColor;
if (clrUnder != (COLORREF)knNinch)
strColor.Load(g_ct.GetColorRid(g_ct.GetIndexFromColor(clrUnder)));
StrApp strFmt;
switch (unt)
{
case kuntDotted:
strFmt.Load(kstidDottedUnderFmt);
break;
case kuntDashed:
strFmt.Load(kstidDashedUnderFmt);
break;
case kuntStrikethrough:
strFmt.Load(kstidStrikethroughUnderFmt);
break;
case kuntSingle:
strFmt.Load(kstidSingleUnderFmt);
break;
case kuntDouble:
strFmt.Load(kstidDoubleUnderFmt);
break;
default:
return;
}
StrApp strT;
strT.Format(strFmt.Chars(), strColor.Chars());
AppendDescPart(strDesc, strT, fFirst);
}
示例3: AddContextInsertItems
/*----------------------------------------------------------------------------------------------
Add menu items for the right-click context Insert menu over tree pane.
----------------------------------------------------------------------------------------------*/
void CleDeSplitChild::AddContextInsertItems(HMENU & hmenu)
{
StrApp str;
CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(MainWindow());
Assert(pcmw);
PossListInfo * ppli = pcmw->GetPossListInfoPtr();
AssertPtr(ppli);
if (!ppli->GetIsSorted())
{
str.Assign(_T("List Item &Above"));
::AppendMenu(hmenu, MF_STRING, kcidInsItemBef, str.Chars());
str.Assign(_T("List Item &Below"));
::AppendMenu(hmenu, MF_STRING, kcidInsItemAft, str.Chars());
}
else
{
str.Assign(_T("List &Item"));
::AppendMenu(hmenu, MF_STRING, kcidInsItem, str.Chars());
}
if (ppli->GetDepth() != 1)
{
str.Assign(_T("List &Subitem"));
::AppendMenu(hmenu, MF_STRING, kcidInsSubItem, str.Chars());
}
}
示例4: GetModuleVersion
/*----------------------------------------------------------------------------------------------
Get the version information for a module. It is passed the path name to the module.
----------------------------------------------------------------------------------------------*/
StrUni GetModuleVersion(const OLECHAR * pchPathName)
{
StrUni stuRet;
#ifdef WIN32
StrApp staPathName = pchPathName;
achar * pchaPathName = const_cast<achar *>(staPathName.Chars());
DWORD dwDum; // Always set to zero.
DWORD cb = GetFileVersionInfoSize(pchaPathName, &dwDum);
LPVOID pBlock = (LPVOID) _alloca(cb);
if (!GetFileVersionInfo(pchaPathName, 0, cb, pBlock))
return stuRet; // Can't get requested info
VS_FIXEDFILEINFO * pffi;
uint nT;
::VerQueryValue(pBlock, _T("\\"), (void **)&pffi, &nT);
stuRet.Format(L"Version: %d, %d, %d, %d", HIWORD(pffi->dwFileVersionMS),
LOWORD(pffi->dwFileVersionMS), HIWORD(pffi->dwFileVersionLS),
LOWORD(pffi->dwFileVersionLS));
#endif
return stuRet;
}
示例5: OnBrws
/*----------------------------------------------------------------------------------------------
This method is called when the user presses Browse button. It opens a dialog to browse for
a help file, then if OK is pressed it puts that filename and path into the help edit box.
----------------------------------------------------------------------------------------------*/
void DetailsPropDlgTab::OnBrws()
{
// Open file dialog.
achar szFile[MAX_PATH];
::ZeroMemory(szFile, MAX_PATH);
OPENFILENAME ofn;
::ZeroMemory(&ofn, sizeof(OPENFILENAME));
// the constant below is required for compatibility with Windows 95/98 (and maybe NT4)
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
ofn.hwndOwner = m_hwnd;
ofn.lpstrFilter = _T("Compiled HTML Help Files (*.chm)\0*.chm\0");
StrApp str(kstidOpenHelp);
ofn.lpstrTitle = str.Chars();
StrApp strHelpPath = AfApp::Papp()->GetFwCodePath().Chars();
strHelpPath.Append(_T("\\Helps\\"));
ofn.lpstrInitialDir = strHelpPath.Chars();
ofn.lpstrFile = szFile;
ofn.nMaxFile = MAX_PATH;
if (IDOK != ::GetOpenFileName(&ofn))
return; // We do not save the results
::SetWindowText(::GetDlgItem(m_hwnd, kctidDetailsPropTabHelpF), szFile);
m_ppropd->SetHelpFile(szFile);
}
示例6: OnNotifyChild
/*----------------------------------------------------------------------------------------------
Process notifications from the user.
----------------------------------------------------------------------------------------------*/
bool FmtGenDlg::OnNotifyChild(int ctidFrom, NMHDR * pnmh, long & lnRet)
{
AssertPtr(pnmh);
switch (pnmh->code)
{
case EN_KILLFOCUS: // Edit control modified.
// Suppress updating the style from the control when we are trying to update the
// control from the style.
if (m_fSuppressLossOfFocus)
break;
if (ctidFrom == kctidFgEdName)
{
if (!m_pafsd->StyleIsSelected())
return true;
StyleInfo & styiSelected = m_pafsd->SelectedStyle();
StrApp strOldName(styiSelected.m_stuName); // Save old name.
StrApp strNewName;
StrUni stuName;
strNewName = GetName();
// If the name has not changed, there is nothing to do.
if (strNewName.Equals(strOldName))
return true;
stuName.Assign(strNewName);
// If the style cannot be named stuName, put the old name back into the control.
if (!m_pafsd->SetName(styiSelected, stuName))
{
::SetDlgItemText(m_hwnd, kctidFgEdName, strOldName.Chars());
return true;
}
// Otherwise update the comboboxes for BasedOn and Next. Also update the edit box
// to handle stripping of leading/trailing blanks.
else
{
::SetDlgItemText(m_hwnd, kctidFgEdName, strNewName.Chars());
UpdateComboboxes(strOldName, strNewName);
}
}
return true;
case CBN_SELCHANGE: // Combo box item changed.
return OnComboChange(pnmh, lnRet);
default:
break;
}
return AfWnd::OnNotifyChild(ctidFrom, pnmh, lnRet);
}
示例7: here
/*----------------------------------------------------------------------------------------------
Called by the framework to initialize the dialog. All one-time initialization should be
done here (that is, all controls have been created and have valid hwnd's, but they
need initial values.)
See ${AfDialog#FWndProc}
@param hwndCtrl (not used)
@param lp (not used)
@return true if Successful
----------------------------------------------------------------------------------------------*/
bool FwPropDlg::OnInitDlg(HWND hwndCtrl, LPARAM lp)
{
StrApp str;
str.Format(_T("%r %r"), AfApp::Papp()->GetAppPropNameId(), kstidPropProperties);
::SendMessage(m_hwnd, WM_SETTEXT, 0, (LPARAM)str.Chars());
m_pszHelpUrl = m_strHelpF.Chars();
GeneralPropDlgTabPtr qgenp;
qgenp.Attach(NewObj GeneralPropDlgTab(this, m_ctidName));
qgenp->EnableLocation(true);
qgenp->EnableSize(true);
qgenp->EnableModified(true);
qgenp->EnableDescription(true);
AfDialogViewPtr qdlgv;
qdlgv = qgenp;
m_vqdlgv.Push(qdlgv);
m_hwndTab = ::GetDlgItem(m_hwnd, kcidLangProjPropDlgTab);
// WARNING: If this ever gets changed to anything but a fixed length buffer, make sure
// ti.pszText is set after loading each string, since the memory pointed to by strb
// could be different each time.
StrAppBuf strb;
TCITEM ti;
ti.mask = TCIF_TEXT;
ti.pszText = const_cast<achar *>(strb.Chars());
// Add a tab to the tab control for each dialog view.
strb.Load(kstidGeneralPropTab);
TabCtrl_InsertItem(m_hwndTab, 0, &ti);
// This section must be after at least one tab gets added to the tab control.
RECT rcTab;
::GetWindowRect(m_hwndTab, &rcTab);
TabCtrl_AdjustRect(m_hwndTab, false, &rcTab);
POINT pt = { rcTab.left, rcTab.top };
::ScreenToClient(m_hwnd, &pt);
m_dxsClient = pt.x;
m_dysClient = pt.y;
// Subclass the Help button.
AfButtonPtr qbtn;
qbtn.Create();
qbtn->SubclassButton(m_hwnd, kctidHelp, kbtHelp, NULL, 0);
ShowChildDlg(m_itabInitial);
AfApp::Papp()->EnableMainWindows(false);
::SetFocus(m_hwndTab);
return SuperClass::OnInitDlg(hwndCtrl, lp);
}
示例8: SetBasedOnStyleComboboxValue
/*----------------------------------------------------------------------------------------------
Selects the "basedOn" style of the specified style in the "basedOn" combobox
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::SetBasedOnStyleComboboxValue(StyleInfo & styi)
{
StrApp strTemp; // Temporary string.
bool fProtectedStyle = m_pafsd->IsStyleProtected(styi.m_stuName);
// Select the "Based On" value from styi for the combobox.
strTemp = m_pafsd->GetNameOfStyle(styi.m_hvoBasedOn);
int icombobox = ::SendMessage(m_hwndBasedOn, CB_FINDSTRINGEXACT, 0,
(LPARAM)strTemp.Chars());
::SendMessage(m_hwndBasedOn, CB_SETCURSEL, icombobox, 0);
// Disable the control for styles originally provided by FieldWorks.
::EnableWindow(m_hwndBasedOn, !fProtectedStyle);
}
示例9: SetName
/*----------------------------------------------------------------------------------------------
The AfStylesDlg calls this when the user edits the name of a style.
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::SetName(StrApp & strNewName)
{
StrApp strOldName;
strOldName = GetName(); // Get the name from the editbox.
// If the name has not changed, there is nothing to do.
if (strNewName.Equals(strOldName))
return;
::SetDlgItemText(m_hwnd, kctidFgEdName, strNewName.Chars());
UpdateComboboxes(strOldName, strNewName); // Update the names in the comboboxes.
}
示例10: LoadNextStyleCombobox
/*----------------------------------------------------------------------------------------------
Loads the "next" combobox for the specified style
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::LoadNextStyleCombobox(StyleInfo & styi)
{
StrApp strTemp; // Temporary string.
// "Next Style" combobox.
::SendMessage(m_hwndNext, CB_RESETCONTENT, 0, 0);
for (int istyi = 0; istyi < m_pafsd->m_vstyi.Size(); istyi++)
{
StyleInfo * pstyiTemp = &m_pafsd->m_vstyi[istyi];
if (pstyiTemp->m_fDeleted)
continue;
strTemp = pstyiTemp->m_stuName;
if (pstyiTemp->m_st == styi.m_st)
::SendMessage(m_hwndNext, CB_ADDSTRING, 0, (LPARAM)strTemp.Chars());
}
}
示例11: AppendOffsetInfo
void AppendOffsetInfo(StrApp & strDesc, int mpOffset, bool & fFirst)
{
if (mpOffset && mpOffset != knNinch)
{
StrApp strFmt;
if (mpOffset < 0)
strFmt.Load(kstidLoweredFmt);
else
strFmt.Load(kstidRaisedFmt);
StrApp strAmt;
StrAppBuf strb;
AfUtil::MakeMsrStr (abs(mpOffset) , knpt, &strb);
StrApp strT;
strT.Format(strFmt.Chars(), strb.Chars());
AppendDescPart(strDesc, strT, fFirst);
}
}
示例12: Create
/*----------------------------------------------------------------------------------------------
Create a new TssEdit. ptss can be NULL if the control should start out empty.
----------------------------------------------------------------------------------------------*/
void TssEdit::Create(HWND hwndPar, int cid, DWORD dwStyle, HWND hwndToolTip, ITsString * ptss,
ILgWritingSystemFactory * pwsf, int ws, IActionHandler * pacth)
{
AssertPtr(pwsf);
PreCreate(pwsf, ws, ptss, pacth);
m_cid = cid;
m_hwndToolTip = hwndToolTip;
m_wsBase = ws;
m_qwsf = pwsf;
if (!m_wsBase)
CheckHr(pwsf->get_UserWs(&m_wsBase)); // get the user interface writing system id.
// Create the window.
WndCreateStruct wcs;
wcs.lpszClass = _T("AfVwWnd");
wcs.hwndParent = hwndPar;
wcs.SetWid(cid);
wcs.style = dwStyle;
CreateHwnd(wcs);
// Add a tool tip.
if (HasToolTip())
{
// Add the combo information to the tooltip.
TOOLINFO ti = { isizeof(ti), TTF_IDISHWND };
#ifdef DEBUG
static StrApp s_str;
s_str.Format(_T("Missing a tooltip for edit control with ID %d"), m_cid);
ti.lpszText = const_cast<achar *>(s_str.Chars());
#else // !DEBUG
ti.lpszText = _T("Dummy text");
#endif // !DEBUG
ti.hwnd = Hwnd();
ti.uId = (uint)ti.hwnd;
::GetClientRect(Hwnd(), &ti.rect);
::SendMessage(m_hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
PostCreate(ptss);
}
示例13: SetNextStyleComboboxValue
/*----------------------------------------------------------------------------------------------
Selects the "next" style of the specified style in the "next" combobox
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::SetNextStyleComboboxValue(StyleInfo & styi)
{
StrApp strTemp; // Temporary string.
int icombobox;
bool fProtectedStyle = m_pafsd->IsStyleProtected(styi.m_stuName);
// Select the "Next Style" values from styi for the combobox.
if (styi.m_st == kstCharacter)
{
icombobox = -1; // Makes it blank.
::EnableWindow(m_hwndNext, false); // And disables it.
}
else
{
strTemp = m_pafsd->GetNameOfStyle(styi.m_hvoNext);
icombobox = ::SendMessage(m_hwndNext, CB_FINDSTRINGEXACT, 0,
(LPARAM)strTemp.Chars());
// Disable the control for styles originally provided by FieldWorks.
::EnableWindow(m_hwndNext, !fProtectedStyle);
}
::SendMessage(m_hwndNext, CB_SETCURSEL, icombobox, 0);
}
示例14: LoadBasedOnStyleCombobox
/*----------------------------------------------------------------------------------------------
Loads the "basedOn" combox for the specified style
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::LoadBasedOnStyleCombobox(StyleInfo & styi)
{
StrApp strName = styi.m_stuName;
StrApp strTemp; // Temporary string.
// "Based On" combobox.
::SendMessage(m_hwndBasedOn, CB_RESETCONTENT, 0, 0);
for (int istyi = 0; istyi < m_pafsd->m_vstyi.Size(); istyi++)
{
StyleInfo * pstyiTemp = &m_pafsd->m_vstyi[istyi];
if (pstyiTemp->m_fDeleted)
continue;
if ((pstyiTemp->m_nContext == knContextInternal ||
pstyiTemp->m_nContext == knContextInternalMappable) && !styi.m_fBuiltIn)
continue;
strTemp = pstyiTemp->m_stuName;
if (pstyiTemp->m_st == styi.m_st)
{
// The based-on list should not include any style that is already based on the
// newly selected one, even indirectly.
if (strName != strTemp && !m_pafsd->IsBasedOn(pstyiTemp, styi.m_hvoStyle))
::SendMessage(m_hwndBasedOn, CB_ADDSTRING, 0, (LPARAM)strTemp.Chars());
}
}
}
示例15: UpdateComboboxes
/*----------------------------------------------------------------------------------------------
Replace strOldName with strNewName in the BasedOn and Next comboboxes.
----------------------------------------------------------------------------------------------*/
void FmtGenDlg::UpdateComboboxes(StrApp & strOldName, StrApp & strNewName)
{
if (!m_pafsd->StyleIsSelected())
return;
StyleInfo styiSelected = m_pafsd->SelectedStyle();
StrApp strTemp;
int icombobox;
// Update the name in the BasedOn combobox if it is there.
icombobox = ::SendMessage(m_hwndBasedOn, CB_FINDSTRINGEXACT, 0, (LPARAM)strOldName.Chars());
if (CB_ERR != icombobox)
{
::SendMessage(m_hwndBasedOn, CB_DELETESTRING, icombobox, 0);
::SendMessage(m_hwndBasedOn, CB_ADDSTRING, 0, (LPARAM)strNewName.Chars());
// Select the BasedOn value.
strTemp = m_pafsd->GetNameOfStyle(styiSelected.m_hvoBasedOn);
icombobox = ::SendMessage(m_hwndBasedOn, CB_FINDSTRINGEXACT, 0,
(LPARAM)strTemp.Chars());
if (CB_ERR != icombobox)
::SendMessage(m_hwndBasedOn, CB_SETCURSEL, icombobox, 0);
}
// Update the name in the Next combobox, but only for a paragraph style.
if (kstParagraph == styiSelected.m_st)
{
icombobox = ::SendMessage(m_hwndNext, CB_FINDSTRINGEXACT, 0,
(LPARAM)strOldName.Chars());
if (CB_ERR != icombobox)
{
::SendMessage(m_hwndNext, CB_DELETESTRING, icombobox, 0);
::SendMessage(m_hwndNext, CB_ADDSTRING, 0, (LPARAM)strNewName.Chars());
// Select the "Next Style" value.
strTemp = m_pafsd->GetNameOfStyle(styiSelected.m_hvoNext);
icombobox = ::SendMessage(m_hwndNext, CB_FINDSTRINGEXACT, 0,
(LPARAM)strTemp.Chars());
if (CB_ERR != icombobox)
::SendMessage(m_hwndNext, CB_SETCURSEL, icombobox, 0);
}
}
return;
}