C++ (Cpp) CString Examples

C++ (Cpp) CString - 30 examples found. These are the top rated real world C++ (Cpp) examples of CString extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
BOOL CMultiUITracker::OneTrackHandle(int nHandle, CWnd* pWnd, BOOL bAllowInvert, CDC* pDCClipTo)
{
    if(m_arrTracker.GetSize()>1)
        return FALSE;

    CControlUI* pControl = m_pFocused->m_pControl;
    m_rect = m_pFocused->GetPos();
    m_bAllowInvert = bAllowInvert;
    BOOL bRet = TrackHandle(nHandle, pWnd, pDCClipTo);
    if(bRet)
    {
        CString strVal;
        strVal.Format(_T("%d,%d,%d,%d"),pControl->GetFixedXY().cx, pControl->GetFixedXY().cy
                      , pControl->GetFixedXY().cx + pControl->GetFixedWidth(), pControl->GetFixedXY().cy + pControl->GetFixedHeight());
        UIAttribute oldAttrib = {_T("pos"), strVal};
        TNotifyUI Msg;
        Msg.pSender = pControl;
        Msg.sType = _T("PropertyBeginChanged");
        Msg.wParam = 0;
        Msg.lParam = (LPARAM)&oldAttrib;
        m_pFocused->m_pOwner->Notify(Msg);

        m_pFocused->SetPos(m_rect);

        strVal.Format(_T("%d,%d,%d,%d"),pControl->GetFixedXY().cx, pControl->GetFixedXY().cy
                      , pControl->GetFixedXY().cx + pControl->GetFixedWidth(), pControl->GetFixedXY().cy + pControl->GetFixedHeight());
        UIAttribute newAttrib = {_T("pos"), strVal};
        Msg.sType = _T("PropertyEndChanged");
        Msg.lParam = (LPARAM)&newAttrib;
        m_pFocused->m_pOwner->Notify(Msg);
    }

    return bRet;
}
Example #2
0
void CCompileEditView::OnMouseMove(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default
    CRichEditView::OnMouseMove(nFlags, point);

    if ( !nFlags && IsDataTip() )
    {
        CString strTitle;
        CString strText = GetTipText(strTitle,nFlags,point);
        if(!strText.IsEmpty())
        {
            //m_pDatatip->On(TRUE);
            //ClientToScreen(&point);
            //if (::GetCursorPos(&point))
            //{
            //m_pDatatip->SetOffset(8,8);
            /*	m_pDatatip->Set(point,strTitle,strText,30,5);*/
            /*	m_pDatatip.Show(strTitle,strText);*/
            //}
        }
        else
        {
            //m_pDatatip->Hide();
        }
    }
    /*
    CWnd* pWnd = GetFocus();
    if(pWnd != NULL && pWnd != m_pDatatip)
    {
    	this->SetFocus();
    }
    */
}
Example #3
0
//********************************************
// ReadFile
// Redirection
//********************************************
int CTexture::ReadFile(char *filename,
                       unsigned int width,
                       unsigned int height,
                       unsigned int depth)
{
    // Cleanup
    Free();

    // Storage
    m_FileName = filename;

    // Extension
    CString string = filename;
    string.MakeLower();
    TRACE("CTexture::ReadFile : file : %s\n",filename);
    CString extension = string.Right(4);

    // Redirection BMP
    if(extension == ".bmp")
        return ReadFileBMP(filename);


    // Redirection RAW
    if(extension == ".raw")
        return ReadFileRAW(filename,width,height,depth);

    // Unrecognized file format
    CString message;
    message.Format("CTexture::ReadFile : invalid file redirection : %s\n",filename);
    AfxMessageBox(string);

    return 0;
}
Example #4
0
void CXTreeCtrl::UpdateGroupStatus(HTREEITEM hGroup, LPCTSTR szGroupText)
{
    int nTotal = 0;
    int nOnLine = 0;

//	int nData = GetItemData(hGroup);
    HTREEITEM hChild = GetChildItem(hGroup);
    while (hChild)
    {
        nTotal ++;
        if (GetItemData(hChild) == STATUS_ONLINE)
            nOnLine++;
        hChild = GetNextSiblingItem(hChild);
    }

    if (nOnLine == 0)
        SetItemColor(hGroup, RGB(128,128,128));
    else
        //	SetItemColor(hGroup, RGB(0, 128, 0));
        SetItemColor(hGroup, RGB(25, 79, 149));
//	CString strOldText;
    CString strNewText;
//	strOldText = GetItemText(hGroup);
    strNewText.Format("%s(%d/%d)", szGroupText, nOnLine, nTotal);
//	AfxMessageBox(aa);
    SetItemText(hGroup, strNewText);
}
Example #5
0
int CRegistry::GetInt(LPCTSTR pszSection, LPCTSTR pszName, int nDefault)
{
    int nValue = nDefault;
    DWORD nErrorCode;
    CString strKey;
    HKEY hKey;

    strKey.Format( _T("Software\\%s\\%s\\%s"), gcszCopyright, theApp.m_pszProfileName, pszSection );

    nErrorCode = RegOpenKeyEx( HKEY_CURRENT_USER, strKey, 0, KEY_READ, &hKey );

    if ( nErrorCode == ERROR_SUCCESS )
    {
        DWORD nType = 0, nSize = sizeof(nValue);

        nErrorCode = RegQueryValueEx( hKey, pszName, 0, &nType, (PBYTE)&nValue, &nSize );

        if ( nType != REG_DWORD || nSize != sizeof(nValue) )
        {
            nErrorCode = ERROR_MORE_DATA;
            nValue = nDefault;
        }

        RegCloseKey( hKey );
    }

    if ( nErrorCode != ERROR_SUCCESS ) DisplayErrorMessageBox( nErrorCode );

    return nValue;
}
Example #6
0
/**
* 响应仪器图形视图弹出菜单设置迂回道
* @param unsigned int uiInstrumentType 低端仪器类型 1-交叉站;2-电源站;3-采集站
* @param unsigned int uiSN 低端仪器设备号
* @param unsigned int uiInstrumentType 高端仪器类型 1-交叉站;2-电源站;3-采集站
* @param unsigned int uiSN 高端仪器设备号
* @return void
*/
void CTabDetour::OnGraphViewInstrumentSetDetour(unsigned int uiInstrumentTypeLow, unsigned int uiSNLow, unsigned int uiInstrumentTypeHigh, unsigned int uiSNHight)
{
    CBCGPGridRow* pRow = NULL;
    COleVariant oVariant;
    pRow = m_oGridCtrlEdit.GetRow(0);

    // 得到BoxType字符串
    CString strBoxType = m_pSiteData->GetBoxTypeStringByID(uiInstrumentTypeLow);
    oVariant = strBoxType;
    pRow->GetItem(0)->SetValue(oVariant);
    CString strSNLow;
    strSNLow.Format("%d", uiSNLow);
    oVariant = strSNLow;
    oVariant.ChangeType(VT_BSTR);
    pRow->GetItem(1)->SetValue(oVariant);
    oVariant = (long)1;
    oVariant.ChangeType(VT_BSTR);
    pRow->GetItem(2)->SetValue(oVariant);

    strBoxType = m_pSiteData->GetBoxTypeStringByID(uiInstrumentTypeHigh);
    oVariant = strBoxType;
    pRow->GetItem(3)->SetValue(oVariant);
    CString strSNHigh;
    strSNHigh.Format("%d", uiSNHight);
    oVariant = strSNHigh;
    oVariant.ChangeType(VT_BSTR);
    pRow->GetItem(4)->SetValue(oVariant);
    oVariant = (long)1;
    oVariant.ChangeType(VT_BSTR);
    pRow->GetItem(5)->SetValue(oVariant);
}