Example #1
0
static CString ExcludePath( const CString& supportPath, const CString& arxPath )
{
    AcStringArray cc;
    SplitCString( supportPath, _T( ";" ), cc );

    AcStringArray paths;

    int n = cc.length();
    for( int i = 0; i < n; i++ )
    {
        if( cc[i].compareNoCase( arxPath ) == 0 ) continue;
        paths.append( cc[i] );
    }

    CString path;
    n = paths.length();
    for( int i = 0; i < n; i++ )
    {
        if( i == n - 1 )
        {
            path.AppendFormat( _T( "%s" ), paths[i].kACharPtr() );
        }
        else
        {
            path.AppendFormat( _T( "%s;" ), paths[i].kACharPtr() );
        }
    }
    return path;
}
Example #2
0
HRESULT CDBStepNC::InsertRow(CString table, CStringVector & columns, CStringVector & values)
{
    CCommand< CDynamicStringAccessor > sqlInsertCommand;
    int i;
    CString tszSQL;
    HRESULT hr;

    if(values.size() != columns.size())
        return E_INVALIDARG;
    if(values.size() == 0 ||  columns.size()==0)
        return E_INVALIDARG;

    tszSQL.Format("INSERT INTO %s (", table);
    for(i=0; i<columns.size(); i++)
    {
        if(i>0) tszSQL+=" ,";
        tszSQL.AppendFormat("%s", columns[i]);
    }
    tszSQL.AppendFormat(") VALUES (");
    for(i=0; i<values.size(); i++)
    {
        if(i>0) tszSQL+=" ,";
        tszSQL.AppendFormat("'%s'", values[i]);
    }
    tszSQL.AppendFormat(")");

    hr = sqlInsertCommand.Open( m_session, tszSQL );
    return hr;

}
void CCalculationCtrlPage::CalculateSeriesPower(int itemIdx)
{
    if((itemIdx < 0) || (itemIdx > (int)m_viewItems.size())) return;

    float viValue = m_viValueEdit.GetFloatValue();

    CResistor resistor = m_viewItems[itemIdx].Resistor;
    CString s;
    float totalPower = 0;
    float current = 0;

    if(m_voltageRadio.GetState()) {
        current = viValue / resistor.Value;
    } else {
        current = viValue;
    }

    for(int i=0; i < (int)resistor.Resistors.size(); ++i) {
        float power = (current * current) * resistor.Resistors[i];
        totalPower += power;
        if(power != 0) {
            s.AppendFormat(
                _T("%.0f Ohm - %.3f W"), resistor.Resistors[i], power
            );
        } else {
            s.AppendFormat(_T("%.0f Ohm"), resistor.Resistors[i]);
        }
        s.Append(L"\r\n");
    }

    if(totalPower != 0) {
        s.AppendFormat(_T("Total: %.3f W"), totalPower);
    }
    m_powerValuesEdit.SetWindowTextW(s);
}
Example #4
0
CMatlabDlg3::CMatlabDlg3(const CString dllFileName, const CString funcName)
: m_DllFileName(dllFileName)
, m_FuncName(funcName)
, m_DllHandle(0)
, m_MatlabFunc(0)
, m_PlaneTrueInput(NULL)
, m_TargetTrueInput(NULL)
, m_TargetFusionInput(NULL)
, m_TargetFilterInput(NULL)
, m_GlobalVarInput(NULL)
, m_Size(50)
, m_IsShowing(false)
{
    m_DllHandle = LoadLibrary(m_DllFileName);
    if (!m_DllHandle)
    {
        CString msg;
        msg.AppendFormat(TEXT("无法装载模块%s."), m_DllFileName);
        AfxMessageBox(msg);
    }
    bool result = false;
    wstring wsFuncName(m_FuncName);
    string sFuncName(wsFuncName.begin(), wsFuncName.end());

    string initializeFuncName = sFuncName;
    initializeFuncName += InitializeFuncPrefix;

    InitializeFunc initializeFunc = (InitializeFunc)GetProcAddress(
        (HMODULE)m_DllHandle,
        initializeFuncName.c_str());

    if (!initializeFunc)
    {
        CString msg;
        msg.AppendFormat(TEXT("无法初始化模块%s."), m_DllFileName);
        AfxMessageBox(msg);
    }

    result = initializeFunc();

    if (!result)
    {
        CString msg;
        msg.AppendFormat(TEXT("初始化模块%s错误."), m_DllFileName);
        AfxMessageBox(msg);
    }

    string fullFuncName = sFuncName;
    fullFuncName[0] = toupper(fullFuncName[0]);
    fullFuncName = FuncPrefix + fullFuncName;
    m_MatlabFunc = (RealFunc)GetProcAddress(
        m_DllHandle,
        fullFuncName.c_str());
    if (!m_MatlabFunc)
    {
        CString msg;
        msg.AppendFormat(TEXT("无法找到入口函数%s."), m_FuncName);
        AfxMessageBox(msg);
    }
}
CString CPdbHelper::GetImageID(HMODULE hModule)
{
	WCHAR wszFileName[MAX_PATH] = {0};
	GetModuleFileNameW( hModule, wszFileName, MAX_PATH);

	SYMSRV_INDEX_INFO tIndexInfo = {0};
	tIndexInfo.sizeofstruct = sizeof(tIndexInfo);
	BOOL bRet = s_pfnSymSrvGetFileIndexInfoW( wszFileName, &tIndexInfo, 0);

	CString strGuid;
	if( bRet )
	{
		LPOLESTR pGuid;
		HRESULT hr = StringFromCLSID( tIndexInfo.guid, &pGuid);
		if( SUCCEEDED(hr) )
		{
			USES_CONVERSION;
			strGuid.Format( _T("%s"), OLE2T(pGuid));
			CoTaskMemFree(pGuid);

			strGuid.Replace( _T("{"), _T(""));
			strGuid.Replace( _T("}"), _T(""));
			strGuid.Replace( _T("-"), _T(""));
			strGuid.AppendFormat(_T("%X"), tIndexInfo.age);
		}
	}

	return strGuid;
}
Example #6
0
BOOL CSampleEditorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_pSampleView = new CSampleView();
	m_pSampleView->SubclassDlgItem(IDC_SAMPLE, this);
	m_pSampleView->CalculateSample(m_pSample, IsDlgButtonChecked(IDC_DELTASTART) ? 64 : 0);
	m_pSampleView->UpdateInfo();

	CSliderCtrl *pitch = (CSliderCtrl*)GetDlgItem(IDC_PITCH);
	pitch->SetRange(0, 15);
	pitch->SetPos(15);

	MoveControls();

	// A timer for the flashing start cursor
	SetTimer(1, 500, NULL);

	CString title;
	GetWindowText(title);
	title.AppendFormat(_T(" [%s]"), m_pSample->Name);
	SetWindowText(title);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void CIPFilterDlg::OnCopyIPFilter()
{
	CWaitCursor curWait;
	int iSelected = 0;
	CString strData;
	POSITION pos = m_ipfilter.GetFirstSelectedItemPosition();
	while (pos)
	{
		int iItem = m_ipfilter.GetNextSelectedItem(pos);
		if (!strData.IsEmpty())
			strData += _T("\r\n");

		strData.AppendFormat(_T("%-15s - %-15s  Hits=%-5s  %s"), 
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_START),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_END),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_HITS),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_DESC));
		iSelected++;
	}

	if (!strData.IsEmpty())
	{
		if (iSelected > 1)
			strData += _T("\r\n");
		theApp.CopyTextToClipboard(strData);
	}
}
Example #8
0
CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
	if( false == IsValid() )
		return _T("");

	CString sResult;
	if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType )
	{
		sResult.Append( RenderToOOXOnlyOle(oRenderParameter) );
	}
	else
	{
		sResult.Append( _T("<w:r>") );
		sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight );
		
		RenderParameter oNewRenderParameter = oRenderParameter;
		oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
		m_oResultPic->m_bIsOle = true;
		sResult.Append( m_oResultPic->RenderToOOX(oNewRenderParameter) );

		oNewRenderParameter.nValue = m_oResultPic->m_nID;
		sResult.Append( RenderToOOXOnlyOle(oNewRenderParameter) );

		sResult.Append( _T("</w:object>") );
		sResult.Append( _T("</w:r>") );
	}
	return sResult;
}
Example #9
0
CString Bin2String(CByteArray *ca)
{
	CString res;
	int k=ca->GetSize();
	for(int i=0;i<k;i++) {
		unsigned char ch=ca->GetAt(i);
		res.AppendFormat(_T("%02x"),ca->GetAt(i));
	}
	return res;
}
void CModulePropertiesDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	CSliderCtrl *pSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS));

	CString text;
	text.LoadString(IDS_PROPERTIES_CHANNELS);
	text.AppendFormat(_T(" %i"),  pSlider->GetPos());
	SetDlgItemText(IDC_CHANNELS_NR, text);

	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
Example #11
0
CString CAvpEchoPerf::FormatPerfNumber(ULONGLONG uPerfNumber)
{
    CString strPerfString;
    if (uPerfNumber >= CFileTime::Second)
    {
        strPerfString.AppendFormat(L"%lu,",     DWORD(uPerfNumber / CFileTime::Second));
        strPerfString.AppendFormat(L"%03lu,",   DWORD(uPerfNumber / CFileTime::Millisecond % 1000));
        strPerfString.AppendFormat(L"%04lu",    DWORD(uPerfNumber % CFileTime::Millisecond));
    }
    else if (uPerfNumber >= CFileTime::Millisecond)
    {
        strPerfString.AppendFormat(L"%lu,",     DWORD(uPerfNumber / CFileTime::Millisecond));
        strPerfString.AppendFormat(L"%04lu",    DWORD(uPerfNumber % CFileTime::Millisecond));
    }
    else
    {
        strPerfString.AppendFormat(L"%lu",      DWORD(uPerfNumber));
    }

    return strPerfString;
}
Example #12
0
CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
{
	CString sResult;

	OOXWriter* poOOXWriter			= static_cast<OOXWriter*>(oRenderParameter.poWriter);
	OOXRelsWriter* poRelsWriter		= static_cast<OOXRelsWriter*>(oRenderParameter.poRels);
	RtfDocument* poDocument			= static_cast<RtfDocument*>(oRenderParameter.poDocument);

	sResult.Append( _T("<o:OLEObject") );
	switch ( m_eOleType )
	{
		case ot_link: sResult.Append( _T(" Type=\"Link\"") );break;
		default: sResult.Append( _T(" Type=\"Embed\"") );break;
	}
    sResult.AppendFormat( _T(" ProgID=\"%ls\""), m_sOleClass.GetBuffer() );
    sResult.AppendFormat( _T(" ShapeID=\"_x0000_s%d\""), poDocument->GetShapeId( oRenderParameter.nValue ) );
	sResult.Append( _T(" DrawAspect=\"Content\"") );
    sResult.AppendFormat( _T(" ObjectID=\"%ls\""), poDocument->m_oIdGenerator.Generate_OleId().GetBuffer() );

	CString sExtension = _T("bin");
	CString sMime = _T("application/vnd.openxmlformats-officedocument.oleObject");
	
	CString sFilenameRels;
    sFilenameRels.AppendFormat( _T("oleObject%d.%ls"), poDocument->m_oIdGenerator.Generate_OleIndex(), sExtension.GetBuffer());
	
	CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("embeddings");
	
	FileSystem::Directory::CreateDirectory( sFilenameFull );
	
	sFilenameFull += FILE_SEPARATOR_STR + sFilenameRels;
	sFilenameRels = _T("embeddings/") + sFilenameRels;

	Utils::CopyDirOrFile( m_sOleFilename, sFilenameFull );

	poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension);
    CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"), sFilenameRels);
    sResult.AppendFormat( _T(" r:id=\"%ls\""), srId.GetBuffer() );
	sResult.Append( _T("/>") );
	return sResult;
}
Example #13
0
CString EncodeUrlUtf8(const CString& rstr)
{
    CString url;
    CStringA utf8(StrToUtf8(rstr));
    for (int i = 0; i < utf8.GetLength(); i++)
    {
        if ((BYTE)utf8[i] >= 0x7F)
            url.AppendFormat(_T("%%%02X"), (BYTE)utf8[i]);
        else
            url += utf8[i];
    }
    return url;
}
Example #14
0
CString CHSCalculate::CreateHtml(const CString& strContent, const InfoIndex* pInfoIndex)
{
	if (pInfoIndex == NULL)
	{
		return "";
	}

	// 读格式文件
	CString strPath = CGeneralHelper::GetAppPath() + _T("face\\html\\") + HTMLFORMAT_PATH;
	CFile  fRead(strPath, CFile::modeRead); 
    long flen = (long)fRead.GetLength(); 
	if (flen <= 0)
	{
		return "";
	}
	char*  pBuffer = new char[flen]; 
	fRead.Read(pBuffer,flen); 
	CString strFotmat(pBuffer, flen);
	delete[] pBuffer;
	fRead.Close();

	//////////////////////////////////////////////////////////////////////////
	// 形成html文件
	// 标题
	strFotmat.Replace(HTML_REPLACE_TITLE, pInfoIndex->m_cTitle);
	// 正文
	// 将换行符替换成<\br>
	CString strFormatContent(strContent, strContent.GetLength());
	strFormatContent.Replace("\r\n", "</br>&nbsp&nbsp");
	strFotmat.Replace(HTML_REPLACE_CONTENT, strContent);
	// 时间
	CString strTime;
	strTime.Format("%04d-%02d-%02d ", pInfoIndex->m_lDate/10000, (pInfoIndex->m_lDate%10000)/100, pInfoIndex->m_lDate%100);
	strTime.AppendFormat("%02d:%02d:%02d", pInfoIndex->m_lTime/10000, (pInfoIndex->m_lTime%10000)/100, pInfoIndex->m_lTime%100);
	strFotmat.Replace(HTML_REPLACE_TIME, strTime);
	// 作者
	CString strAuthor = "";
	strFotmat.Replace(HTML_REPLACE_AUTHOR, strAuthor);
	// 来源
	CString strOrigin = "";
	strFotmat.Replace(HTML_REPLACE_ORIGIN, strOrigin);
	//////////////////////////////////////////////////////////////////////////

	// 写html文件
	strPath = CGeneralHelper::GetAppPath() + _T("face\\html\\") + HTMLCONTENT_PATH;
	CFile fWrite(strPath, CFile::modeCreate | CFile::modeWrite);
	fWrite.Write(strFotmat.GetBuffer(), strFotmat.GetLength());
	fWrite.Close();

	return strPath;
}
Example #15
0
	void CBLog::_AddInfo( CString &strLog )
	{
		time_t ct = time(NULL);
		tm otm;
		localtime_s(&otm, &ct);
		SYSTEMTIME st;
		GetSystemTime(&st);
		strLog.Format(_T("%d-%d-%d %d:%d:%d.%d \t"),
			otm.tm_year+1900,otm.tm_mon+1,otm.tm_mday,
			otm.tm_hour,otm.tm_min,otm.tm_sec,st.wMilliseconds
			);
		DWORD threadID = GetCurrentThreadId();
		ThreadNameMap::iterator i;
		i = m_threadNameMap.find(threadID);
		if ( i != m_threadNameMap.end() )
		{
			strLog.AppendFormat(_T("%s(%d) \t"), i->second,threadID);
		}
		else
		{
			strLog.AppendFormat(_T("%d \t"), threadID);
		}
	}
BOOL CModulePropertiesDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Get active document
	CFrameWnd *pFrameWnd = static_cast<CFrameWnd*>(GetParent());
	m_pDocument = static_cast<CFamiTrackerDoc*>(pFrameWnd->GetActiveDocument());

	CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST));
	pSongList->InsertColumn(0, _T("Songs"), 0, 150);
	pSongList->SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);

	FillSongList();

	// Expansion chips
	CComboBox *pChipBox = static_cast<CComboBox*>(GetDlgItem(IDC_EXPANSION));
	int ExpChip = m_pDocument->GetExpansionChip();
	CChannelMap *pChannelMap = theApp.GetChannelMap();

	for (int i = 0; i < pChannelMap->GetChipCount(); ++i)
		pChipBox->AddString(pChannelMap->GetChipName(i));

	pChipBox->SetCurSel(pChannelMap->GetChipIndex(ExpChip));

	// Vibrato 
	CComboBox *pVibratoBox = static_cast<CComboBox*>(GetDlgItem(IDC_VIBRATO));
	pVibratoBox->SetCurSel((m_pDocument->GetVibratoStyle() == VIBRATO_NEW) ? 0 : 1);

	// Namco channel count
	CSliderCtrl *pChanSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS));
	pChanSlider->SetRange(1, 8);
	CString channelsStr;
	channelsStr.LoadString(IDS_PROPERTIES_CHANNELS);
	if (ExpChip == SNDCHIP_N163) {
		int Channels = m_pDocument->GetNamcoChannels();
		pChanSlider->SetPos(Channels);
		pChanSlider->EnableWindow(TRUE);
		channelsStr.AppendFormat(_T(" %i"), Channels);
	}
	else {
		pChanSlider->SetPos(0);
		pChanSlider->EnableWindow(FALSE);
		channelsStr.Append(_T(" N/A"));
	}
	SetDlgItemText(IDC_CHANNELS_NR, channelsStr);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Example #17
0
void CSubtitleDlDlg::OnDestroy()
{
    RemoveAllAnchors();

    const CHeaderCtrl& pHC = *m_list.GetHeaderCtrl();
    CString strColumnWidth;
    int w;

    for (int i = 0; i < pHC.GetItemCount(); ++i) {
        w = m_list.GetColumnWidth(i);
        strColumnWidth.AppendFormat(L"%d,", w);
    }
    AfxGetApp()->WriteProfileString(IDS_R_DLG_SUBTITLEDL, IDS_RS_DLG_SUBTITLEDL_COLWIDTH, strColumnWidth);

    __super::OnDestroy();
}
Example #18
0
bool FusionLocalAlgo::Init()
{
    switch (m_Type)
    {
    case FusionLocalAlgoTypeTest1:
        m_Func = &FusionLocalAlgoTest1;
        break;
    case FusionLocalAlgoTypeTest2:
        m_Func = &FusionLocalAlgoTest2;
        break;
    default:
        CString msg;
        msg.AppendFormat(TEXT("未知本地融合算法%d."), m_Type);
        AfxMessageBox(msg);
        return false;
    }
    return true;
}
Example #19
0
void CUploadListCtrl::OnLvnGetInfoTip(NMHDR *pNMHDR, LRESULT *pResult)
{
    LPNMLVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMLVGETINFOTIP>(pNMHDR);
    if (pGetInfoTip->iSubItem == 0)
    {
        LVHITTESTINFO hti = {0};
        ::GetCursorPos(&hti.pt);
        ScreenToClient(&hti.pt);
        if (SubItemHitTest(&hti) == -1 || hti.iItem != pGetInfoTip->iItem || hti.iSubItem != 0) {
            // don't show the default label tip for the main item, if the mouse is not over the main item
            if ((pGetInfoTip->dwFlags & LVGIT_UNFOLDED) == 0 && pGetInfoTip->cchTextMax > 0 && pGetInfoTip->pszText[0] != _T('\0'))
                pGetInfoTip->pszText[0] = _T('\0');
            return;
        }

        const CUpDownClient* client = (CUpDownClient*)GetItemData(pGetInfoTip->iItem);
        if (client && pGetInfoTip->pszText && pGetInfoTip->cchTextMax > 0)
        {
            CString strInfo;
            strInfo.Format(GetResString(IDS_USERINFO), client->GetUserName());
            // ==> requpfile optimization [SiRoB] - Stulle
            /*
            const CKnownFile* file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID());
            */
            const CKnownFile* file = client->CheckAndGetReqUpFile();
            // <== requpfile optimization [SiRoB] - Stulle
            if (file)
            {
                strInfo += GetResString(IDS_SF_REQUESTED) + _T(' ') + file->GetFileName() + _T('\n');
                strInfo.AppendFormat(GetResString(IDS_FILESTATS_SESSION) + GetResString(IDS_FILESTATS_TOTAL),
                                     file->statistic.GetAccepts(), file->statistic.GetRequests(), CastItoXBytes(file->statistic.GetTransferred(), false, false),
                                     file->statistic.GetAllTimeAccepts(), file->statistic.GetAllTimeRequests(), CastItoXBytes(file->statistic.GetAllTimeTransferred(), false, false));
            }
            else
            {
                strInfo += GetResString(IDS_REQ_UNKNOWNFILE);
            }
            strInfo += TOOLTIP_AUTOFORMAT_SUFFIX_CH;
            _tcsncpy(pGetInfoTip->pszText, strInfo, pGetInfoTip->cchTextMax);
            pGetInfoTip->pszText[pGetInfoTip->cchTextMax-1] = _T('\0');
        }
    }
    *pResult = 0;
}
Example #20
0
	CString Directory::GetTempPath()
	{
        TCHAR pBuffer [MAX_PATH+1];
        memset (pBuffer, 0, sizeof (TCHAR) * (MAX_PATH+1));
		::GetTempPathW (MAX_PATH, pBuffer);
        CString res;
        res.AppendFormat(_T("%ls"), pBuffer);
       
		int nSeparator1Pos = res.ReverseFind(_T('/'));
        if (-1 == nSeparator1Pos)
        {
            nSeparator1Pos = res.ReverseFind(_T('\\'));
        }

        if (-1 == nSeparator1Pos)
            return _T("");

		return res.Mid (0, nSeparator1Pos);
	}
Example #21
0
void CHallQueFrontView::ShowWaitNum(const CString& queID,const int waitNum )
{
	int count = m_pTrackCtrl->m_selTrackerAll.GetCount();
	for(int i=0;i<count;i++)
	{
		if(m_pTrackCtrl->m_selTrackerAll[i]->GetWindowType() == enmStatic)
		{
			if(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->GetIsShowQueNum())
			{
				if(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->GetLinkAddress() 
					== queID)
				{
					CString head = m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->
						GetForShowQueNumHead();
					head.AppendFormat(_T("%d"),waitNum);
					m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->SetWindowText(head);
					/*
					//获取字的尺寸
					CSize textSize;
					HDC hdc = ::GetDC(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->m_hWnd);
					LOGFONT lf = m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->GetTextFont();
					CFont font;
					font.CreateFontIndirect(&lf);
					HFONT hOldFont = (HFONT) SelectObject(hdc,font);
					GetTextExtentPoint32(hdc,head,head.GetLength(),&textSize);
					SelectObject(hdc,hOldFont);
					::ReleaseDC(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->m_hWnd,hdc);
					//////////////////////////////////
					//重新设置大小
					CRect oldRect;
					m_pTrackCtrl->m_selTrackerAll[i]->GetTrueRect(oldRect);
					CRect newRect;
					newRect.left = oldRect.left;newRect.right = oldRect.left + textSize.cx;
					newRect.top = oldRect.top;newRect.bottom = oldRect.top + textSize.cy;
					m_pTrackCtrl->m_selTrackerAll[i]->SetRect(newRect);
					*/
					m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->Invalidate(TRUE);
					break;
				}
			}
		}
	}
}
Example #22
0
CString CFGFilterLAV::GetVersion(LAVFILTER_TYPE filterType /*= INVALID*/)
{
    CStringList paths;

    if (filterType == INVALID) {
        paths.AddTail(GetFilterPath(SPLITTER));
        paths.AddTail(GetFilterPath(VIDEO_DECODER));
        paths.AddTail(GetFilterPath(AUDIO_DECODER));
    } else {
        paths.AddTail(GetFilterPath(filterType));
    }

    QWORD uiVersionMin = UINT64_MAX;
    QWORD uiVersionMax = 0ui64;
    CString strVersionMin, strVersionMax;
    POSITION pos = paths.GetHeadPosition();
    while (pos) {
        CString& path = paths.GetNext(pos);

        QWORD version = FileVersionInfo::GetFileVersionNum(path);
        if (version) {
            if (version < uiVersionMin) {
                uiVersionMin = version;
                strVersionMin = FileVersionInfo::FormatVersionString(version);
            }
            if (version > uiVersionMax) {
                uiVersionMax = version;
                strVersionMax = FileVersionInfo::FormatVersionString(version);
            }
        }
    }

    CString version;
    if (uiVersionMin != UINT64_MAX) {
        version = strVersionMin;
        if (uiVersionMax != uiVersionMin) {
            version.AppendFormat(_T(" - %s"), strVersionMax);
        }
    }

    return version;
}
void CMuleToolbarCtrl::OnTbnToolbarChange(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
	CString config;
	for (int i = 0; i < GetButtonCount();i++)
	{
		TBBUTTON buttoninfo;
		if (GetButton(i, &buttoninfo))
			config.AppendFormat(_T("%02i"), (buttoninfo.idCommand != 0) ? buttoninfo.idCommand - IDC_TOOLBARBUTTON : 99);
	}

	thePrefs.SetToolbarSettings(config);
	Localize();

	theApp.emuledlg->ShowConnectionState();

	SetAllButtonsWidth();
	AutoSize();

	*pResult = 0;
}
Example #24
0
// CPage4 消息处理程序
void CPage4::OnBnClickedButton1()
{
	CString str = "";
	CString temp = "";
	int height = 0;
	m_height.GetWindowText(temp);
	if (temp.IsEmpty() || !isdigit(temp.GetString()))
	{
		//AfxMessageBox("the heigt must be number");
		m_height.SetFocus();
	}
	height = atoi(temp);
	height = (height+1)*60 + 58;
	int i = 1;
	str.Format("{\"%s\":\"%s\",\"%s\":","method","getluckynum","params");
	str.AppendFormat("[%d],\"id\":%d}\n",height,i);
	m_commandstr = str;
	CWnd* m_pMainWnd = AfxGetApp()->m_pMainWnd;
	m_pMainWnd->SendMessage(WM_MY_SendQuery,0,0);
}
void CModulePropertiesDlg::OnCbnSelchangeExpansion()
{
	CComboBox *pExpansionChipBox = static_cast<CComboBox*>(GetDlgItem(IDC_EXPANSION));
	CSliderCtrl *pSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS));

	// Expansion chip
	unsigned int iExpansionChip = theApp.GetChannelMap()->GetChipIdent(pExpansionChipBox->GetCurSel());

	CString channelsStr;
	channelsStr.LoadString(IDS_PROPERTIES_CHANNELS);
	if (iExpansionChip == SNDCHIP_N163) {
		pSlider->EnableWindow(TRUE);
		int Channels = m_pDocument->GetNamcoChannels();
		pSlider->SetPos(Channels);
		channelsStr.AppendFormat(_T(" %i"), Channels);
	}
	else {
		pSlider->EnableWindow(FALSE);
		channelsStr.Append(_T(" N/A"));
	}
	SetDlgItemText(IDC_CHANNELS_NR, channelsStr);
}
Example #26
0
void CInstrumentEditorVRC7::OnCopy()
{
	CString MML;

	int patch = m_pInstrument->GetPatch();
	// Assemble a MML string
	for (int i = 0; i < 8; ++i)
		MML.AppendFormat(_T("$%02X "), (patch == 0) ? (unsigned char)(m_pInstrument->GetCustomReg(i)) : default_inst[patch * 16 + i]);
	
	if (!OpenClipboard())
		return;

	EmptyClipboard();

	int size = MML.GetLength() + 1;
	HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE, size);
	LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hMem);  
	strcpy_s(lptstrCopy, size, MML.GetBuffer());
	GlobalUnlock(hMem);
	SetClipboardData(CF_TEXT, hMem);
	CloseClipboard();
}
Example #27
0
void CMainDlg::DoInMainThread(CString strText)
{
    static int _s_nLogCount = 0;
    
    strText.AppendFormat(L"\r\n输出日志运行线程ID:%d\r\n\r\n", ::GetCurrentThreadId());
    CString strLog;
    GetDlgItemText(IDC_STATIC_TEXT, strLog);
    
    if (_s_nLogCount++ > 100)
    {
        _s_nLogCount = 0;
        strLog.Empty();
    }

    strLog.Insert(0, strText);
    SetDlgItemText(IDC_STATIC_TEXT, strLog);

    CString strInfo;
    strInfo.Format(L"线程池运行线程数:%d,任务数:%d,回收站线程数:%d", SparkThreadPool::Instance().GetThreadCount(),
        SparkThreadPool::Instance().GetTaskCount(), SparkThreadPool::Instance().GetTrashThreadCount());
    SetDlgItemText(IDC_STATIC_INFO, strInfo);
}
Example #28
0
void CSequenceEditor::SequenceChangedMessage(bool Changed)
{
	CString Text;

	// Translate sequence to MML-like string
	Text = "";

	for (unsigned i = 0; i < m_pSequence->GetItemCount(); ++i) {
		if (m_pSequence->GetLoopPoint() == i)
			Text.Append(_T("| "));
		else if (m_pSequence->GetReleasePoint() == i)
			Text.Append(_T("/ "));
		Text.AppendFormat(_T("%i "), m_pSequence->GetItem(i));
	}

	dynamic_cast<CSequenceInstrumentEditPanel*>(m_pParent)->SetSequenceString(Text, Changed);
	//((CSequenceInstrumentEditPanel*)m_pParent)->SetSequenceString(Text, Changed);

	// Set flag in document
	if (Changed)
		((CFrameWnd*)AfxGetMainWnd())->GetActiveDocument()->SetModifiedFlag();
}
Example #29
0
void CInstrumentEditorFDS::OnBnClickedCopyTable()
{
	CString Str;

	// Assemble a MML string
	for (int i = 0; i < 32; ++i)
		Str.AppendFormat(_T("%i "), m_pInstrument->GetModulation(i));

	if (!OpenClipboard())
		return;

	EmptyClipboard();

	int size = Str.GetLength() + 1;
	HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE, size);
	LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hMem);  
	strcpy_s(lptstrCopy, size, Str.GetBuffer());
	GlobalUnlock(hMem);
	SetClipboardData(CF_TEXT, hMem);

	CloseClipboard();
}
void CQueueListCtrl::GetItemDisplayText(const CUpDownClient *client, int iSubItem, LPTSTR pszText, int cchTextMax)
{
	if (pszText == NULL || cchTextMax <= 0) {
		ASSERT(0);
		return;
	}
	pszText[0] = _T('\0');
	switch (iSubItem)
	{
		case 0:
			if (client->GetUserName() == NULL)
				_sntprintf(pszText, cchTextMax, _T("(%s)"), GetResString(IDS_UNKNOWN));
			else
				_tcsncpy(pszText, client->GetUserName(), cchTextMax);
			break;

		case 1: {
			const CKnownFile *file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID());
			_tcsncpy(pszText, file != NULL ? file->GetFileName() : _T(""), cchTextMax);
			break;
		}

		case 2: {
			const CKnownFile *file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID());
			if (file)
			{
				// ==> PowerShare [ZZ/MorphXT] - Stulle
				/*
				switch (file->GetUpPriority())
				{
					case PR_VERYLOW:
						_tcsncpy(pszText, GetResString(IDS_PRIOVERYLOW), cchTextMax);
						break;
					
					case PR_LOW:
						if (file->IsAutoUpPriority())
							_tcsncpy(pszText, GetResString(IDS_PRIOAUTOLOW), cchTextMax);
						else
							_tcsncpy(pszText, GetResString(IDS_PRIOLOW), cchTextMax);
						break;
					
					case PR_NORMAL:
						if (file->IsAutoUpPriority())
							_tcsncpy(pszText, GetResString(IDS_PRIOAUTONORMAL), cchTextMax);
						else
							_tcsncpy(pszText, GetResString(IDS_PRIONORMAL), cchTextMax);
						break;

					case PR_HIGH:
						if (file->IsAutoUpPriority())
							_tcsncpy(pszText, GetResString(IDS_PRIOAUTOHIGH), cchTextMax);
						else
							_tcsncpy(pszText, GetResString(IDS_PRIOHIGH), cchTextMax);
						break;

					case PR_VERYHIGH:
						_tcsncpy(pszText, GetResString(IDS_PRIORELEASE), cchTextMax);
						break;
					//Xman PowerRelease
					case PR_POWER:
						_tcsncpy(pszText, GetResString(IDS_POWERRELEASE), cchTextMax);
						break;
					//Xman end
				}
				*/
				CString Sbuffer;
				switch (file->GetUpPriority()) {
					case PR_VERYLOW : {
						Sbuffer = GetResString(IDS_PRIOVERYLOW);
						break; }
					case PR_LOW : {
						if( file->IsAutoUpPriority() )
							Sbuffer = GetResString(IDS_PRIOAUTOLOW);
						else
							Sbuffer = GetResString(IDS_PRIOLOW);
						break; }
					case PR_NORMAL : {
						if( file->IsAutoUpPriority() )
							Sbuffer = GetResString(IDS_PRIOAUTONORMAL);
						else
							Sbuffer = GetResString(IDS_PRIONORMAL);
						break; }
					case PR_HIGH : {
						if( file->IsAutoUpPriority() )
							Sbuffer = GetResString(IDS_PRIOAUTOHIGH);
						else
							Sbuffer = GetResString(IDS_PRIOHIGH);
						break; }
					case PR_VERYHIGH : {
						Sbuffer = GetResString(IDS_PRIORELEASE);
						break; }
					//Xman PowerRelease
					case PR_POWER: {
						Sbuffer = GetResString(IDS_POWERRELEASE);
						break; }
					//Xman end
					default:
						Sbuffer.Empty();
				}
				if(client->GetPowerShared(file)) {
					CString tempString = GetResString(IDS_POWERSHARE_PREFIX);
					tempString.Append(_T(","));
					tempString.Append(Sbuffer);
					Sbuffer.Empty();
					Sbuffer = tempString;
				}
				// ==> Fair Play [AndCycle/Stulle] - Stulle
				if (!file->IsPartFile() && file->statistic.GetFairPlay()) {
					Sbuffer.Append(_T(",FairPlay"));
				}
				// <== Fair Play [AndCycle/Stulle] - Stulle
				_tcsncpy(pszText, Sbuffer, cchTextMax);
				// <== PowerShare [ZZ/MorphXT] - Stulle
			}
			break;
		}
		
		case 3:
			_sntprintf(pszText, cchTextMax, _T("%i"), client->GetScore(false, false, true));
			break;
		
		case 4:
			// ==> Display reason for zero score [Stulle] - Stulle
			/*
			if (client->HasLowID()) {
				if (client->m_bAddNextConnect)
					_sntprintf(pszText, cchTextMax, _T("%i ****"),client->GetScore(false));
				else
					_sntprintf(pszText, cchTextMax, _T("%i (%s)"),client->GetScore(false), GetResString(IDS_IDLOW));
			}
			//Xman uploading problem client
			else if(client->isupprob && client->m_bAddNextConnect)
			{
				if(client->socket && client->socket->IsConnected())
					_sntprintf(pszText, cchTextMax, _T("%i #~~"),client->GetScore(false));
				else
					_sntprintf(pszText, cchTextMax, _T("%i ~~~"),client->GetScore(false));
			}
			//Xman end
			else
				_sntprintf(pszText, cchTextMax, _T("%i"), client->GetScore(false));
			*/
			{
				CString Sbuffer;
				uint32 uScore = client->GetScore(false);
				if (client->HasLowID()){
					if (client->m_bAddNextConnect)
						Sbuffer.Format(_T("%i ****"),uScore);
					else
						Sbuffer.Format(_T("%i (%s)"),uScore, GetResString(IDS_IDLOW));
				}
				//Xman uploading problem client
				else if(client->isupprob && client->m_bAddNextConnect)
				{
					if(client->socket && client->socket->IsConnected())
						Sbuffer.Format(_T("%i #~~"),uScore);
					else
						Sbuffer.Format(_T("%i ~~~"),uScore);
				}
				//Xman end
				else
					Sbuffer.Format(_T("%i"),uScore);

				if(uScore == 0)
					Sbuffer.AppendFormat(_T(" (%s)"),client->GetZeroScoreString());

				// ==> Pay Back First [AndCycle/SiRoB/Stulle] - Stulle
				if (client->IsPBFClient())
				{
					CString tempStr;
					if (client->IsSecure())
						tempStr.Format(_T("%s %s"), _T("PBF"), Sbuffer);
					else
						tempStr.Format(_T("%s %s"), _T("PBF II"), Sbuffer);
					Sbuffer = tempStr;
				}
				// <== Pay Back First [AndCycle/SiRoB/Stulle] - Stulle

				_tcsncpy(pszText, Sbuffer, cchTextMax);
			}
			// <== Display reason for zero score [Stulle] - Stulle
			break;

		case 5:
			_sntprintf(pszText, cchTextMax, _T("%i"), client->GetAskedCount());
			break;
		
		case 6:
			_tcsncpy(pszText, CastSecondsToHM((GetTickCount() - client->GetLastUpRequest()) / 1000), cchTextMax);
			break;

		case 7:
			_tcsncpy(pszText, CastSecondsToHM((GetTickCount() - client->GetWaitStartTime()) / 1000), cchTextMax);
			break;

		case 8:
			//Xman Code Improvement
			/*
			_tcsncpy(pszText, GetResString(client->IsBanned() ? IDS_YES : IDS_NO), cchTextMax);
			*/
			_tcsncpy(pszText, GetResString(client->GetUploadState() == US_BANNED ? IDS_YES : IDS_NO), cchTextMax);
			//Xman end
			break;

		case 9:
			_tcsncpy(pszText, GetResString(IDS_UPSTATUS), cchTextMax);
			break;
		//Xman version see clientversion in every window
		case 10:
			_tcsncpy(pszText, client->DbgGetFullClientSoftVer(), cchTextMax); //Xman // Maella -Support for tag ET_MOD_VERSION 0x55
			break;
		//Xman end

		//Xman show complete up/down in queuelist
		case 11:
			if(client->Credits() )
				_sntprintf(pszText, cchTextMax, _T("%s/ %s"), CastItoXBytes(client->credits->GetUploadedTotal()), CastItoXBytes(client->credits->GetDownloadedTotal()));
			break;
		//Xman end

		// ==> push small files [sivka] - Stulle
		case 12:
		{
			if (client->GetSmallFilePush())
				_tcsncpy(pszText, GetResString(IDS_YES), cchTextMax);
			else
				_tcsncpy(pszText, GetResString(IDS_NO), cchTextMax);
			break;
		}
		// <== push small files [sivka] - Stulle

		// ==> push rare file - Stulle
		case 13:
		{
			_sntprintf(pszText, cchTextMax, _T("%.1f"), client->GetRareFilePushRatio());
			break;
		}
		// <== push rare file - Stulle
	}
	pszText[cchTextMax - 1] = _T('\0');
}