本文整理汇总了C++中CString::LockBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::LockBuffer方法的具体用法?C++ CString::LockBuffer怎么用?C++ CString::LockBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::LockBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Find
void CFindDlg::Find(int nSearchFlags, bool bNext)
{
// try to find text
if (!m_pEdit) return;
if (bNext)
{
CString strFind;
m_ctrlSearchtext.GetWindowText(strFind);
StoreSearchString ((CGumpEditorApp*)AfxGetApp(), strFind);
m_pEdit->SetSearchflags(nSearchFlags);
if(!m_pEdit->SearchForward(strFind.LockBuffer()))
{
MessageBeep(0);
}
strFind.UnlockBuffer();
}
else
{
CString strFind;
m_ctrlSearchtext.GetWindowText(strFind);
StoreSearchString ((CGumpEditorApp*)AfxGetApp(), strFind);
m_pEdit->SetSearchflags(nSearchFlags);
if(!m_pEdit->SearchBackward(strFind.LockBuffer()))
{
MessageBeep(0);
}
strFind.UnlockBuffer();
}
}
示例2: CopyItem
HTREEITEM EXTreeCtrl::CopyItem(HTREEITEM hItem, HTREEITEM htiNewParent, HTREEITEM htiAfter)
{
TV_INSERTSTRUCT tvstruct;
HTREEITEM hNewItem;
CString sText;
// get information of the source item
tvstruct.item.hItem = hItem;
tvstruct.item.mask = TVIF_CHILDREN | TVIF_HANDLE |
TVIF_IMAGE | TVIF_SELECTEDIMAGE;
GetItem(&tvstruct.item);
sText = GetItemText( hItem );
tvstruct.item.cchTextMax = sText.GetLength();
tvstruct.item.pszText = sText.LockBuffer();
// Insert the item at proper location
tvstruct.hParent = htiNewParent;
tvstruct.hInsertAfter = htiAfter;
tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
hNewItem = InsertItem(&tvstruct);
sText.ReleaseBuffer();
// Now copy item data and item state.
SetItemData( hNewItem, GetItemData( hItem ));
SetItemState( hNewItem, GetItemState( hItem, TVIS_STATEIMAGEMASK ),
TVIS_STATEIMAGEMASK );
// ins.item.lParam = (LPARAM)(pItem);
// Call virtual function to allow further processing in derived class
// OnItemCopied( hItem, hNewItem );
return hNewItem;
}
示例3: OnToolHitTest
int CLogo::OnToolHitTest(CPoint point, TOOLINFO *pTI) const
{
CString ToolTipText;
if(::IsWindow(m_hWnd) && ToolTipText.LoadString(GetDlgCtrlID()))
{
int nDelPos = ToolTipText.Find(_T('\n'));
if(nDelPos != -1)
ToolTipText = ToolTipText.Right(ToolTipText.GetLength()-nDelPos-1);
}
if(ToolTipText.IsEmpty())
return -1;
int nLen = ToolTipText.GetLength();
PTCHAR pText = PTCHAR(::malloc((nLen+1)*sizeof(TCHAR)));
if(!pText)
return -1;
::_tcscpy(pText,ToolTipText.LockBuffer());
ToolTipText.UnlockBuffer();
pTI->lpszText = pText;
pTI->hwnd = m_hWnd;
CRect ClientRect;
GetClientRect(ClientRect);
pTI->rect.left = ClientRect.left;
pTI->rect.top = ClientRect.top;
pTI->rect.right = ClientRect.right;
pTI->rect.bottom = ClientRect.bottom;
return 1;
}
示例4: show_message
void CSTATUS_DIALOG::show_message(UINT msg_id)
{
CString msg;
msg.LoadString(msg_id);
show_message(msg.LockBuffer());
msg.UnlockBuffer();
}
示例5: SwapLTALTC
bool SwapLTALTC(CString &sFilename)
{
// If it's too short, it's not an option
if (sFilename.GetLength() < 4)
return false;
// Point at the end of the string
char *pBuffer = sFilename.LockBuffer();
char *pLastChar = &pBuffer[sFilename.GetLength() - 1];
bool bResult = true;
// Make sure it's LT? for the extension
if ((pLastChar[-3] != '.') ||
(toupper(pLastChar[-2]) != 'L') ||
(toupper(pLastChar[-1]) != 'T'))
{
bResult = false;
}
// Switch it
else if (toupper(*pLastChar) == 'A')
*pLastChar = 'C';
else if (toupper(*pLastChar) == 'C')
*pLastChar = 'A';
else
bResult = false;
sFilename.UnlockBuffer();
return bResult;
}
示例6: DecryptEMailServerPassword
CString CDlgSettingFtpEmail::DecryptEMailServerPassword(CString csEncrypt)
{
CString csDecrypt;
CByteArray cbArray2;
LPCSTR lpSTR;
USES_CONVERSION;
lpSTR = W2A(csEncrypt.LockBuffer());
csEncrypt.UnlockBuffer();
unsigned char hexdata[32];
memset(hexdata, 0, sizeof(unsigned char)*32);
strtohex(lpSTR, hexdata);
cbArray2.SetSize(csEncrypt.GetLength()/2);
for(int iTemp = 0; iTemp < (csEncrypt.GetLength()/2); iTemp++)
{
cbArray2[iTemp] = (BYTE)hexdata[iTemp];
}
m_CCrypto.Decrypt(cbArray2, csDecrypt);
return csDecrypt;
}
示例7: OnChildNotify
BOOL CWndIndirectTalk::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
CWorld* pWorld = g_WorldMng();
CObj* pObj = pWorld->GetObjFocus();
if( pObj && pObj->GetType() == OT_MOVER )
{
switch( nID )
{
case WIDC_EDIT2: // 본문
if( message != EN_RETURN )
break;
case WIDC_BUTTON1:
{
CWndEdit* pWndEdit1 = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
CWndEdit* pWndEdit2 = (CWndEdit*)GetDlgItem( WIDC_EDIT2 );
LPCTSTR lpId = pWndEdit1->m_string;
LPCTSTR lpText = pWndEdit2->m_string;
CString string;
string.Format( "/id %s %s", lpId, lpText );
ParsingCommand( string.LockBuffer(), g_pPlayer );
string.UnlockBuffer();
pWndEdit2->Empty();
}
break;
}
}
if( nID == WTBID_CLOSE )
{
Destroy( TRUE );
return TRUE;
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
示例8: CopyTreeItem
HTREEITEM CTreeViewEx::CopyTreeItem( HTREEITEM hItem, HTREEITEM hNewParentItem,HTREEITEM hAfterItem )
{
TV_INSERTSTRUCT tvstruct;
HTREEITEM hNewItem;
CString sText;
CTreeCtrl& omTreeCtrl = GetTreeCtrl();
// get information of the source item
tvstruct.item.hItem = hItem;
tvstruct.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE ;
omTreeCtrl.GetItem(&tvstruct.item);
sText = omTreeCtrl.GetItemText( hItem );
tvstruct.item.cchTextMax = sText.GetLength();
tvstruct.item.pszText = sText.LockBuffer();
// Insert the item at proper location
tvstruct.hParent = hNewParentItem;
tvstruct.hInsertAfter = hAfterItem;
tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
hNewItem = omTreeCtrl.InsertItem(&tvstruct);
sText.ReleaseBuffer();
// Now copy item data and item state.
omTreeCtrl.SetItemData( hNewItem, omTreeCtrl.GetItemData( hItem ));
omTreeCtrl.SetItemState( hNewItem, omTreeCtrl.GetItemState( hItem, TVIS_STATEIMAGEMASK ),
TVIS_STATEIMAGEMASK );
return hNewItem;
}
示例9: FillTreeView
void CFunctionPage::FillTreeView(HTREEITEM hRootItem, MessageStruct* pMes)
{
if ((int)_AtlModule.m_eWTLVersion < eWTL75 && pMes->Type & REFLECTION_MESSAGE)
return;
TVITEM* tvi;
TVINSERTSTRUCT tvis;
ZeroMemory(&tvis, sizeof(tvis));
tvi = &tvis.item;
tvi->mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi->lParam = (LPARAM)pMes;
CString Name = pMes->Message;
LPTSTR pName = Name.LockBuffer();
tvi->pszText = pName;
tvi->cchTextMax = Name.GetLength() + 1;
int Type = pMes->Type & TYPE_MASK;
if (pMes->IconIndex == -1)
{
if (Type == ROOT_PLACE)
{
tvi->iImage = 0;
tvi->iSelectedImage = 0;
}
else
{
tvi->iImage = 2;
tvi->iSelectedImage = 2;
}
}
else
{
tvi->iSelectedImage = tvi->iImage = pMes->IconIndex;
}
tvi->cChildren = 0;
tvis.hParent = hRootItem;
int Flags = pMes->Type & FLAGS_MASK;
if (Flags & CUSTOM_MESSAGE)
{
tvis.hInsertAfter = TVI_LAST;
}
else
{
tvis.hInsertAfter = TVI_SORT;
}
HTREEITEM NewItem = m_Messages.InsertItem(&tvis);
Name.UnlockBuffer();
if (Type == ROOT_PLACE)
{
for (size_t i = 0; i < pMes->Children.GetCount(); i++)
{
FillTreeView(NewItem, pMes->Children[i]);
}
}
}
示例10: MoveChildItem
HTREEITEM CZoneTree::MoveChildItem(HTREEITEM hItem, HTREEITEM htiNewParent, HTREEITEM htiAfter)
{
TV_INSERTSTRUCT tvstruct;
HTREEITEM hNewItem;
CString sText;
int i;
// get information of the source item
tvstruct.item.hItem = hItem;
tvstruct.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
GetItem(&tvstruct.item);
sText = GetItemText( hItem );
tvstruct.item.cchTextMax = sText.GetLength();
tvstruct.item.pszText = sText.LockBuffer();
//insert the item at proper location
tvstruct.hParent = htiNewParent;
tvstruct.hInsertAfter = htiAfter;
tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
hNewItem = InsertItem(&tvstruct);
sText.ReleaseBuffer();
GetItemImage(hNewItem, i, i);
switch(i) {
case OBJECT_DATA:
ConvertObjToIndex(hItem, hNewItem, htiNewParent);
break;
case OBJ_INDEX:
CopyObjIndex(hItem, hNewItem, htiNewParent);
break;
case MOB_DATA:
ConvertMobToIndex(hItem, hNewItem, htiNewParent);
break;
case MOB_INDEX:
CopyMobIndex(hItem, hNewItem, htiNewParent);
break;
}
SetItemState(hNewItem,GetItemState(hItem,TVIS_STATEIMAGEMASK),TVIS_STATEIMAGEMASK);
HTREEITEM hItemChild = GetChildItem(hItem);
while (hItemChild != NULL)
{
HTREEITEM hItemNextChild = GetNextSiblingItem(hItemChild);
MoveChildItem(hItemChild, hNewItem, TVI_LAST);
hItemChild = hItemNextChild;
}
return hNewItem;
}
示例11: AddDiskObject
void CNBListViewCtrl::AddDiskObject(CNBUnitDevice *o)
{
LVITEM lvItem = { 0 };
CString strName = o->GetName();
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iItem = GetItemCount();
lvItem.pszText = strName.LockBuffer();
lvItem.lParam = (LPARAM)o;
CListViewCtrl::InsertItem( &lvItem );
CListViewCtrl::SetItemText(lvItem.iItem, 1, o->GetCapacityString());
}
示例12: FirstCharBig
void Speller::FirstCharBig(CString& s){
LPTSTR bf=s.LockBuffer();
for(;*bf;bf++){
if( isalpha2(*bf) ){
*bf &= ~0x20;
bf++;
break;
}
}
_tcslwr(bf); //остаток строки - вниз
s.UnlockBuffer();
}
示例13: Localize
void CDetailInfo::Localize()
{
if (NULL == GetSafeHwnd())
return;
LVCOLUMN lc;
CString str;
lc.mask = LVCF_TEXT;
str = GetResString(IDS_DETAILINFO_NAME);
lc.pszText = str.LockBuffer();
m_ListDetail.SetColumn(0, &lc);
str.UnlockBuffer();
str = GetResString(IDS_DETAILINFO_VALUE);
lc.pszText = str.LockBuffer();
m_ListDetail.SetColumn(1, &lc);
str.UnlockBuffer();
UpdateInfo(m_pCurFile, m_dwCurMask);
}
示例14: ToolBarCtrl_SetText
void ToolBarCtrl_SetText(CToolBarCtrl *ptbc, int iIndex, LPCTSTR lpszText)
{
CString strText;
TBBUTTONINFO tbbi;
ZeroMemory(&tbbi, sizeof(tbbi));
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_BYINDEX | TBIF_TEXT;
strText = lpszText;
tbbi.pszText = strText.LockBuffer();
tbbi.cchText = strText.GetLength();
ptbc->SetButtonInfo(iIndex, &tbbi);
strText.UnlockBuffer();
}
示例15: GrantAllPrivs
void GrantAllPrivs(HANDLE h)
{
Log(L"DEBUG: GrantAllPrivs", false);
CString privs = L"SeCreateTokenPrivilege,SeAssignPrimaryTokenPrivilege,SeLockMemoryPrivilege,SeIncreaseQuotaPrivilege,SeMachineAccountPrivilege,"
L"SeTcbPrivilege,SeSecurityPrivilege,SeTakeOwnershipPrivilege,SeLoadDriverPrivilege,SeSystemProfilePrivilege,SeSystemtimePrivilege,SeProfileSingleProcessPrivilege,"
L"SeIncreaseBasePriorityPrivilege,SeCreatePagefilePrivilege,SeCreatePermanentPrivilege,SeBackupPrivilege,SeRestorePrivilege,SeShutdownPrivilege,SeDebugPrivilege,"
L"SeAuditPrivilege,SeSystemEnvironmentPrivilege,SeChangeNotifyPrivilege,SeRemoteShutdownPrivilege,SeUndockPrivilege,SeSyncAgentPrivilege,SeEnableDelegationPrivilege,"
L"SeManageVolumePrivilege,SeImpersonatePrivilege,SeCreateGlobalPrivilege,SeTrustedCredManAccessPrivilege,SeRelabelPrivilege,SeIncreaseWorkingSetPrivilege,"
L"SeTimeZonePrivilege,SeCreateSymbolicLinkPrivilege";
wchar_t* pC = wcstok(privs.LockBuffer(), L",");
while(NULL != pC)
{
EnablePrivilege(pC, h); //needed to call CreateProcessAsUser
pC = wcstok(NULL, L",");
}
}