コード例 #1
0
ファイル: UIButton.cpp プロジェクト: Zhuguoping/directui
void CButtonUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
    if( _tcscmp(pstrName, _T("normalimage")) == 0 ) SetNormalImage(pstrValue);
    else if( _tcscmp(pstrName, _T("hotimage")) == 0 ) SetHotImage(pstrValue);
    else if( _tcscmp(pstrName, _T("pushedimage")) == 0 ) SetPushedImage(pstrValue);
    else if( _tcscmp(pstrName, _T("focusedimage")) == 0 ) SetFocusedImage(pstrValue);
    else if( _tcscmp(pstrName, _T("disabledimage")) == 0 ) SetDisabledImage(pstrValue);
    else if( _tcscmp(pstrName, _T("hottextcolor")) == 0 ) {
        if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
        LPTSTR pstr = NULL;
        DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
        SetHotTextColor(clrColor);
    }
    else if( _tcscmp(pstrName, _T("pushedtextcolor")) == 0 ) {
        if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
        LPTSTR pstr = NULL;
        DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
        SetPushedTextColor(clrColor);
    }
    else if( _tcscmp(pstrName, _T("focusedtextcolor")) == 0 ) {
        if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
        LPTSTR pstr = NULL;
        DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
        SetFocusedTextColor(clrColor);
    }
    else CLabelUI::SetAttribute(pstrName, pstrValue);
}
コード例 #2
0
ファイル: UIPie.cpp プロジェクト: the7day/py-ui4win
	void CPieUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcscmp(pstrName, _T("corrdinate")) == 0 ) {
			LPTSTR pstr = NULL;
			SIZE frame;
			frame.cx = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			frame.cy = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			SetArc1Corrdinate(frame);
		}    
		else if( _tcscmp(pstrName, _T("radius")) == 0 ) {
			LPTSTR pstr = NULL;
			DWORD dwRadius = _tcstoul(pstrValue, &pstr, 10);
			SetArc1Radius(dwRadius);
		}
		else if( _tcscmp(pstrName, _T("piecolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetArc1Color(clrColor);
		} 
		else if( _tcscmp(pstrName, _T("angle")) == 0 ) {
			LPTSTR pstr = NULL;
			DWORD dwStartAngle = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			DWORD dwEndAngle = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			SetArc1Angle(dwStartAngle, dwEndAngle);
		} 
		else CControlUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #3
0
ファイル: UICheckBox.cpp プロジェクト: h82258652/YDWE
	void CCheckBoxUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcscmp(pstrName, _T("selected")) == 0 ) Selected(_tcscmp(pstrValue, _T("true")) == 0);
		else if( _tcscmp(pstrName, _T("selectedimage")) == 0 ) m_sSelectedImage.reset(new CImage(pstrValue));
		else if( _tcscmp(pstrName, _T("selectedhotimage")) == 0 ) m_sSelectedHotImage.reset(new CImage(pstrValue));
		else if( _tcscmp(pstrName, _T("selectedpushedimage")) == 0 ) m_sSelectedPushedImage.reset(new CImage(pstrValue));		
		else if( _tcscmp(pstrName, _T("selecteddisabledimage")) == 0 ) m_sSelectedDisabledImage.reset(new CImage(pstrValue));
		else if( _tcscmp(pstrName, _T("selectedbkcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			m_dwSelectedBkColor = clrColor;
		}
		else if( _tcscmp(pstrName, _T("selectedtextcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			m_dwSelectedTextColor = clrColor;
		}
		else if( _tcscmp(pstrName, _T("selectedpushedtextcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			m_dwSelectedPushedTextColor = clrColor;
		}
		else CButtonUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #4
0
ファイル: UITreeView.cpp プロジェクト: goodgo/TradeClient
	//************************************
	// 函数名称: SetAttribute
	// 返回类型: void
	// 参数信息: LPCTSTR pstrName
	// 参数信息: LPCTSTR pstrValue
	// 函数说明: 
	//************************************
	void CTreeViewUI::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
	{
		if(_tcscmp(pstrName,_T("visiblefolderbtn")) == 0)
			SetVisibleFolderBtn(_tcscmp(pstrValue,_T("true")) == 0);
		else if(_tcscmp(pstrName,_T("visiblecheckbtn")) == 0)
			SetVisibleCheckBtn(_tcscmp(pstrValue,_T("true")) == 0);
		else if(_tcscmp(pstrName,_T("itemminwidth")) == 0)
			SetItemMinWidth(_ttoi(pstrValue));
		else if(_tcscmp(pstrName, _T("itemtextcolor")) == 0 ){
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetItemTextColor(clrColor);
		}
		else if(_tcscmp(pstrName, _T("itemhottextcolor")) == 0 ){
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetItemHotTextColor(clrColor);
		}
		else if(_tcscmp(pstrName, _T("selitemtextcolor")) == 0 ){
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetSelItemTextColor(clrColor);
		}
		else if(_tcscmp(pstrName, _T("selitemhottextcolor")) == 0 ){
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetSelItemHotTextColor(clrColor);
		}
		else CListUI::SetAttribute(pstrName,pstrValue);
	}
コード例 #5
0
ファイル: BugTrapUtils.cpp プロジェクト: 3rdexp/fxfile
/**
 * @brief Compare two list view items.
 * @param lParam1 - 1st item index.
 * @param lParam2 - 2nd item index.
 * @param lParamSort - sort argument.
 * @return comparison result.
 */
int CALLBACK ListViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
	LISTVIEW_SORT_PARAMS* pLVSortParams = (LISTVIEW_SORT_PARAMS*)lParamSort;
	TCHAR szItem1Text[256];
	ListView_GetItemText(pLVSortParams->hwndList, lParam1, pLVSortParams->iColumnNumber, szItem1Text, countof(szItem1Text));
	TCHAR szItem2Text[256];
	ListView_GetItemText(pLVSortParams->hwndList, lParam2, pLVSortParams->iColumnNumber, szItem2Text, countof(szItem2Text));
	int iResult;
	switch (pLVSortParams->eCompareType)
	{
	case LISTVIEW_SORT_PARAMS::ICT_STRING:
		iResult = _tcscmp(szItem1Text, szItem2Text);
		break;
	case LISTVIEW_SORT_PARAMS::ICT_INTEGER:
		{
			int iItemValue1 = _ttoi(szItem1Text);
			int iItemValue2 = _ttoi(szItem2Text);
			iResult = Comparator(iItemValue1, iItemValue2);
		}
		break;
	case LISTVIEW_SORT_PARAMS::ICT_HEXADECIMAL:
		{
			unsigned uItemValue1 = _tcstoul(szItem1Text, NULL, 16);
			unsigned uItemValue2 = _tcstoul(szItem2Text, NULL, 16);
			iResult = Comparator(uItemValue1, uItemValue2);
		}
		break;
	default:
		iResult = 0;
		break;
	}
	return (pLVSortParams->bAscending ? iResult : -iResult);
}
コード例 #6
0
int CALLBACK CDialogProcSelect::CompareFunction( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort )
{
    PCOMPARESTRUCT pCompare = (PCOMPARESTRUCT)lParamSort;
    if (pCompare)
    {
        CListCtrl* pListCtrl = pCompare->pListCtrl;
        INT column = pCompare->iColumn;
        BOOLEAN bAscending = pCompare->bAscending;

        int item1 = bAscending ? static_cast<int>(lParam1) : static_cast<int>(lParam2);
        int item2 = bAscending ? static_cast<int>(lParam2) : static_cast<int>(lParam1);

        if (column == COLUMN_PROCESSID)
        {
            CString strValue1 = pListCtrl->GetItemText( item1, column );
            CString strValue2 = pListCtrl->GetItemText( item2, column );
            DWORD value1 = (DWORD)_tcstoul( strValue1.GetString( ), NULL, 16 );
            DWORD value2 = (DWORD)_tcstoul( strValue2.GetString( ), NULL, 16 );

            return (int)(value2 - value1);
        }
        else if (column == COLUMN_PROCESSNAME)
        {
            CString strModuleName1 = pListCtrl->GetItemText( item1, column );
            CString strModuleName2 = pListCtrl->GetItemText( item2, column );

            return strModuleName1.CompareNoCase( strModuleName2 );
        }
    }
    return 0;
}
コード例 #7
0
ファイル: SkinComboBox.cpp プロジェクト: HuugY/MFC_Project
void CSkinComboBox::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
{
	ISkinControl::SetAttribute(pstrName,pstrValue);
	LPTSTR pstr = NULL;

	if( _tcscmp(pstrName, _T("droplist")) == 0 ) 
	{
		if( _tcscmp(pstrValue, _T("true")) == 0 )
		{
			ModifyStyle(0,CBS_OWNERDRAWVARIABLE|CBS_HASSTRINGS);
			SetDropList();
		}
	}
	else if( _tcscmp(pstrName, _T("defaulttext")) == 0 )  SetDefaultText(pstrValue);
	else if( _tcscmp(pstrName, _T("arrownormalimg")) == 0 )  SetArrowNormalPic(pstrValue);	
	else if( _tcscmp(pstrName, _T("arrowhotimg")) == 0 )  SetArrowHotPic(pstrValue);	
	else if( _tcscmp(pstrName, _T("arrowpushimg")) == 0 )  SetArrowPushedPic(pstrValue);
	else if( _tcscmp(pstrName, _T("arrowwidth")) == 0 )  SetArrowWidth(_ttoi(pstrValue));	
	else if( _tcscmp(pstrName, _T("boxheight")) == 0 )  SetEditItemHeight(_ttoi(pstrValue)); 
	else if( _tcscmp(pstrName, _T("itemheight")) == 0 )  SetAllItemHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) 
	{
		if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
		SetEditTextColor( _tcstoul(pstrValue, &pstr, 16));
	}
	else if( _tcscmp(pstrName, _T("bkcolor")) == 0 ) 
	{
		if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
		m_SkinComboBoxEdit.m_colBack = _tcstoul(pstrValue, &pstr, 16);
	}
	else if( _tcscmp(pstrName, _T("format")) == 0 ) 
	{
		m_SkinComboBoxEdit.ModifyStyle(0,_ttoi(pstrValue));
	}
}
コード例 #8
0
UINT CPPNumEdit::GetValue()
{
	TRACE(_T("CPPNumEdit::GetValue()\n"));

	GetWindowText(m_strText);
	
	UINT nValue = 0;
	switch (m_nIndexValue)
	{
	case PPNUM_VALUE_DEC:
		nValue = _tcstoul (m_strText, 0, 10);
		break;
	case PPNUM_VALUE_HEX:
		nValue = _tcstoul (m_strText, 0, 16);
		break;
	case PPNUM_VALUE_BIN:
		nValue = _tcstoul (m_strText, 0, 2);
		break;
	case PPNUM_VALUE_OCT:
		nValue = _tcstoul (m_strText, 0, 8);
		break;
	case PPNUM_VALUE_ASCII:
		if (m_strText.GetLength())
		{
			nValue = LOBYTE(m_strText.GetAt(0));
		}
		else
			nValue = 0;
		break;
	}

	return nValue;
}
コード例 #9
0
void CNetworkAdapter::SetSpeed( LPCTSTR lpstrSpeed)
{
	CString csBuffer = lpstrSpeed;

	m_csSpeed = lpstrSpeed;
	StrForSQL( m_csSpeed);
	// Recalculate byte speed
	if (csBuffer.Find( _T( " Gb/s")) >= 0)
	{
		csBuffer.TrimRight( _T( " Gb/s"));
		m_ulSpeed = _tcstoul( csBuffer, NULL, 10) * 1000000000;
		return;
	}
	if (csBuffer.Find( _T( " Mb/s")) >= 0)
	{
		csBuffer.TrimRight( _T( " Mb/s"));
		m_ulSpeed = _tcstoul( csBuffer, NULL, 10) * 1000000;
		return;
	}
	if (csBuffer.Find( _T( " Kb/s")) >= 0)
	{
		csBuffer.TrimRight( _T( " Kb/s"));
		m_ulSpeed = _tcstoul( csBuffer, NULL, 10) * 1000;
		return;
	}
	csBuffer.TrimRight( _T( " b/s"));
	m_ulSpeed = _tcstoul( csBuffer, NULL, 10);
}
コード例 #10
0
ファイル: UIOption.cpp プロジェクト: arlen7772gg/TIMSDK
	void COptionUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcsicmp(pstrName, _T("group")) == 0 ) SetGroup(pstrValue);
		else if( _tcsicmp(pstrName, _T("selected")) == 0 ) Selected(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("selectedimage")) == 0 ) SetSelectedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("selectedhotimage")) == 0 ) SetSelectedHotImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("selectedpushedimage")) == 0 ) SetSelectedPushedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("selectedforeimage")) == 0 ) SetSelectedForedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("selectedstateimage")) == 0 ) SetSelectedStateImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("selectedstatecount")) == 0 ) SetSelectedStateCount(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("selectedbkcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetSelectedBkColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("selectedtextcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetSelectedTextColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("selectedfont")) == 0 ) SetSelectedFont(_ttoi(pstrValue));
		else CButtonUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #11
0
ファイル: windozeHelpers.cpp プロジェクト: azwing/indi
//////////////////////////// 
// GET     VID   AND   PID
void windozeHelpers::GetVidAndPid( const uint16_t DeviceNum, 
                                  uint16_t & vid,
                                  uint16_t & pid )
{

    CString Path;
    windozeHelpers::FetchUsbDevicePath( DeviceNum, Path );
    
    CString vv( _T("vid_") );
    int32_t start = Path.Find( vv );
    int32_t stop = Path.Find( _T("&"), start);
    start = start + vv.GetLength();
    int32_t len = stop-start;
    

    CString vidStr = Path.Mid( start, len );

    vid = static_cast<uint16_t>( _tcstoul(vidStr, 0, 16) );

    CString pp( _T("pid_") );
    start = Path.Find( pp );
    stop =Path.Find( _T("#"), start);
    start = start + pp.GetLength();
    len = stop-start;
    

    CString pidStr = Path.Mid( start, len );

    pid = static_cast<uint16_t>( _tcstoul(pidStr, 0, 16) );
}
コード例 #12
0
ファイル: UIButton.cpp プロジェクト: hioscar/DuiLib_Ultimate
	void CButtonUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcsicmp(pstrName, _T("normalimage")) == 0 ) SetNormalImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("hotimage")) == 0 ) SetHotImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("pushedimage")) == 0 ) SetPushedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("focusedimage")) == 0 ) SetFocusedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("disabledimage")) == 0 ) SetDisabledImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("hotforeimage")) == 0 ) SetHotForeImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("bindtabindex")) == 0 ) BindTabIndex(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("bindtablayoutname")) == 0 ) BindTabLayoutName(pstrValue);
		else if( _tcsicmp(pstrName, _T("hotbkcolor")) == 0 )
		{
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetHotBkColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("pushedbkcolor")) == 0 )
		{
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetPushedBkColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("hottextcolor")) == 0 )
		{
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetHotTextColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("pushedtextcolor")) == 0 )
		{
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetPushedTextColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("focusedtextcolor")) == 0 )
		{
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetFocusedTextColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("noprefix")) == 0 )
		{
			if( _tcsicmp(pstrValue, _T("true")) == 0)
			{
				m_uTextStyle |= DT_NOPREFIX;
			}
			else
			{
				m_uTextStyle = m_uTextStyle & ~DT_NOPREFIX;
			}
		}
		else CLabelUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #13
0
ファイル: WinRobotHost.cpp プロジェクト: Nillouise/WinRobot
	/*!
		install service		-i 
		uninstall service	-u 
		run as service		-runas service
		run as session		-runas session -parent n
		check and install	-c
		run hook			-runas hook -parent n
	*/
	bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode) throw()
	{
		if (!CAtlServiceModuleT< CWinRobotHostModule, IDS_SERVICENAME >::ParseCommandLine(lpCmdLine, pnRetCode))
			return false;

		TCHAR szTokens[] = _T("-/");
		*pnRetCode = S_OK;

		LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
		while (lpszToken != NULL)
		{
			if (WordCmpI(lpszToken, _T("I"))==0) // install
			{
				*pnRetCode = RegisterAppId(true);
				if (SUCCEEDED(*pnRetCode))
					*pnRetCode = RegisterServer(TRUE);
				return false;
			}
			else if (WordCmpI(lpszToken, _T("U"))==0)// uninstall
			{
				*pnRetCode = UnregisterServer(TRUE);
				if (SUCCEEDED(*pnRetCode))
					*pnRetCode = UnregisterAppId();
				return false;
			}
			else if (WordCmpI(lpszToken, _T("runas"))==0)
			{
				lpszToken = FindOneOf(lpszToken, _T(" "));
				if (WordCmpI(lpszToken, _T("service")) == 0) // run as service
				{
					return true;
				}
				else if(WordCmpI(lpszToken, _T("session")) == 0) // run as session
				{
					lpszToken = FindOneOf(lpszToken, _T("-/"));
					if(WordCmpI(lpszToken, _T("parent")) == 0)
					{
						lpszToken = FindOneOf(lpszToken, _T(" "));
						CSessionHost host(_tcstoul(lpszToken,0,10));
						host.Run();
						host.WaitThreadEnd();
					}
				}
				else if(WordCmpI(lpszToken, _T("hook")) == 0) // run as session
				{
					lpszToken = FindOneOf(lpszToken, _T("-/"));
					if(WordCmpI(lpszToken, _T("parent")) == 0)
					{
						lpszToken = FindOneOf(lpszToken, _T(" "));
						CHookHost host(_tcstoul(lpszToken,0,10));
						host.Run();
					}
				}
				return false;
			}
			lpszToken = FindOneOf(lpszToken, szTokens);
		}
		return true;
	}
コード例 #14
0
HRESULT CSECEditor::DecodeLocation (const CString &strLocation, CStdEditorPosition &position)
{
    int iPos;
    CString strLine;
    CString strColumn;
    LPTSTR pszLine;
    LPTSTR pszColumn;
    LPTSTR pszEnd;
    unsigned long ulLine;
    unsigned long ulColumn;

    iPos = strLocation.Find (_T (','));
    if (iPos == -1)
    {
        strLine = strLocation;
        strColumn = "1";
    }
    else
    {
        strLine = strLocation.Left (iPos);

        strColumn = strLocation.Mid (iPos + 1);
        strColumn.TrimLeft ();
        strColumn.TrimRight ();

        if (strColumn.IsEmpty ())
        {
            return (E_FAIL);
        };
    };

    strLine.TrimLeft ();
    strLine.TrimRight ();

    if (strLine.IsEmpty ())
    {
        return (E_FAIL);
    };

    pszLine = strLine.GetBuffer (0);
    ulLine = _tcstoul (pszLine, &pszEnd, 10);
    strLine.ReleaseBuffer ();
    if (*pszEnd != _T ('\0'))
    {
        return (E_FAIL);
    };

    pszColumn = strColumn.GetBuffer (0);
    ulColumn = _tcstoul (pszColumn, &pszEnd, 10);
    strColumn.ReleaseBuffer ();
    if (*pszEnd != _T ('\0'))
    {
        return (E_FAIL);
    };

    position = CStdEditorPosition (EDP_STLINE, ulColumn, ulLine);
    return (S_OK);
}
コード例 #15
0
ファイル: UILabel.cpp プロジェクト: h82258652/YDWE
	void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcscmp(pstrName, _T("text")) == 0 ) SetText(pstrValue);
		else if( _tcscmp(pstrName, _T("align")) == 0 ) {
			if( _tcsstr(pstrValue, _T("left")) != NULL ) {
				m_uTextStyle &= ~(DT_CENTER | DT_RIGHT);
				m_uTextStyle |= DT_LEFT;
			}
			if( _tcsstr(pstrValue, _T("center")) != NULL ) {
				m_uTextStyle &= ~(DT_LEFT | DT_RIGHT);
				m_uTextStyle |= DT_CENTER;
			}
			if( _tcsstr(pstrValue, _T("right")) != NULL ) {
				m_uTextStyle &= ~(DT_LEFT | DT_CENTER);
				m_uTextStyle |= DT_RIGHT;
			}
			if( _tcsstr(pstrValue, _T("top")) != NULL ) {
				m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER);
				m_uTextStyle |= DT_TOP;
			}
			if( _tcsstr(pstrValue, _T("vcenter")) != NULL ) {
				m_uTextStyle &= ~(DT_TOP | DT_BOTTOM);			
				m_uTextStyle |= DT_VCENTER;
			}
			if( _tcsstr(pstrValue, _T("bottom")) != NULL ) {
				m_uTextStyle &= ~(DT_TOP | DT_VCENTER);
				m_uTextStyle |= DT_BOTTOM;
			}
		}
		else if( _tcscmp(pstrName, _T("endellipsis")) == 0 ) {
			if( _tcscmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS;
			else m_uTextStyle &= ~DT_END_ELLIPSIS;
		}    
		else if( _tcscmp(pstrName, _T("font")) == 0 ) SetFont(_ttoi(pstrValue));
		else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetTextColor(clrColor);
		}
		else if( _tcscmp(pstrName, _T("disabledtextcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetDisabledTextColor(clrColor);
		}
		else if( _tcscmp(pstrName, _T("textpadding")) == 0 ) {
			RECT rcTextPadding = { 0 };
			LPTSTR pstr = NULL;
			rcTextPadding.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);    
			rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);    
			SetTextPadding(rcTextPadding);
		}
		else if( _tcscmp(pstrName, _T("showhtml")) == 0 ) SetShowHtml(_tcscmp(pstrValue, _T("true")) == 0);
		else CControlUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #16
0
ファイル: DialogProcess.cpp プロジェクト: simileas/prodo
void CDialogProcess::OnNMRClickListProc(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
	int index = pNMLV->iItem;

	CString szCid;
	CPoint pt;

	DWORD dwCid;

	if( index == -1 )
		return;

	HMENU hMenu = ::CreatePopupMenu();
	AppendMenu( hMenu, MF_STRING, 10001, _T("进程模块") );
	AppendMenu( hMenu, MF_STRING, 10002, _T("结束进程") );
	
	GetCursorPos(&pt);

	UINT Cmd = (UINT)::TrackPopupMenu( hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pt.x, pt.y, 0, m_hWnd, NULL );

	switch( Cmd )
	{
	case 10001:
		{
			m_DialogDll.ShowWindow(SW_SHOW);

			m_DialogDll.m_ListDll.DeleteAllItems();

			szCid = m_ListProc.GetItemText(index, 0);
			dwCid = _tcstoul(szCid, 0, 10);
			GetDll(dwCid);
		}
		break;
	case 10002:
		{
			szCid = m_ListProc.GetItemText(index, 0);

			dwCid = _tcstoul(szCid, 0, 10);

			if( KillProcess(dwCid) )
			{
				m_ListProc.DeleteItem(index);
			}
			else
			{
				MessageBoxA(NULL, "Kill process failed.","ERROR", MB_OK);
			}
		}
		break;
	}
	*pResult = 0;
}
コード例 #17
0
/**
 * @brief
 *  Called when the user had changed the values
 *  in the edit fields for the bit timing registers.
 *  The baud rate combo box selection will we set
 *  to "user defined" or the CiA baud rate.
 *
 */
void CCANControllerConfigDlg::UpdateComboBoxIndexFromEditFields()
{
    TCHAR szText[20];
    TCHAR* szDummy;
    m_editBTR0.GetWindowText(szText, 20);
    m_dwBTR0 = (DWORD) _tcstoul(szText, &szDummy, 16);


    m_editBTR1.GetWindowText(szText, 20);
    m_dwBTR1 = (DWORD) _tcstoul(szText, &szDummy, 16);

    int iIndexInList = GetListIndexFromBTRRegisters();
    m_comboBoxCiABaudSelection.SetCurSel(iIndexInList);
}
コード例 #18
0
void COptionBytesDialog_L1::OnApply() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	BYTE User  = _tcstoul(m_User_Value, 0, 16) ;
	BYTE RDP   = _tcstoul(m_RDP_Value, 0, 16) ;
	SHORT WRP01  = _tcstoul(m_WRP0_Value, 0, 16) ;
	BYTE WRP0 = WRP01;
	BYTE WRP1= WRP01>>8;
	SHORT WRP23  = _tcstoul(m_WRP2_Value, 0, 16) ;
	BYTE WRP2 = WRP23;
	BYTE WRP3= WRP23>>8;
	SHORT WRP45  = _tcstoul(m_WRP4_Value, 0, 16) ;
	BYTE WRP4 = WRP45;
	BYTE WRP5= WRP45>>8;
	SHORT WRP67  = _tcstoul(m_WRP6_Value, 0, 16) ;
	BYTE WRP6 = WRP67;
	BYTE WRP7= WRP67>>8;
	SHORT WRP89  = _tcstoul(m_WRP8_Value, 0, 16) ;
	BYTE WRP8 = WRP89;
	BYTE WRP9= WRP89>>8;
	SHORT WRP1011  = _tcstoul(m_WRP10_Value, 0, 16) ;
	BYTE WRP10 = WRP1011;
	BYTE WRP11= WRP1011>>8;



	UpdateData(FALSE);

	SetOptions(User, RDP, WRP0, WRP1 ,WRP2, WRP3 , WRP4, WRP5 , WRP6, WRP7 ,WRP8, WRP9 ,WRP10, WRP11 );

	STDFU_Close(&m_phDevice);
	
	CDialog::OnOK();
}
コード例 #19
0
ファイル: Main.cpp プロジェクト: localvar/backup
static void LoadSettings()
{
	CIniFile ini;
	ini.OpenDefault();

	Settings.lVersion = 0;

	// general section
	CIniSection* sctn = ini.GetSection( g_szGeneralSection );
	Settings.dwSnapshot = sctn->GetValueInt( g_szSnapshot, ED_MINI_DUMP );
	LPCTSTR str = sctn->GetValueString( g_szDumpPath, _T("") );
	_tcsncpy( Settings.szDumpPath, str, _countof(Settings.szDumpPath) );
	Settings.szDumpPath[_countof(Settings.szDumpPath) - 1] = 0;

	// crash section
	sctn = ini.GetSection( g_szCrashSection );
	Settings.dwFirstChance = sctn->GetValueInt( g_szFirstChance, ED_DONT_DUMP );
	Settings.dwSecondChance = sctn->GetValueInt(g_szSecondChance, ED_MINI_DUMP);
	Settings.bAutoDelete = sctn->GetValueBool( g_szAutoDelete, true );

	// user exception list
	sctn = ini.GetSection( g_szUserExceptionSection );
	size_t pos = sctn->GetFirstKeyPosition();
	while( pos != 0xffffffff )
	{
		CIniKey* key = sctn->GetNextKey( pos );

		CExceptionInfo ei;
		ei.bUser = true;
		ei.bFiltered = false;
		ei.dwCode = _tcstoul( key->GetName(), NULL, 0 );
		_tcsncpy( ei.szName, key->GetValueString(), _countof(ei.szName) );
		ei.szName[_countof(ei.szName) - 1] = 0;
		g_aException.Add( ei );
	}

	// filter section
	sctn = ini.GetSection( g_szFilterSection );
	pos = sctn->GetFirstKeyPosition();
	while( pos != 0xffffffff )
	{
		CIniKey* key = sctn->GetNextKey( pos );
		DWORD code = _tcstoul( key->GetName(), NULL, 0 );
		CExceptionInfo* pei = GetExceptionInfoByCode( code );
		if( pei != NULL )
			pei->bFiltered = key->GetValueBool();
	}
}
コード例 #20
0
ファイル: KeyEditDlg.cpp プロジェクト: redneckz/vocatch
bool CKeyEditDlg::GetPassword(DWORD dwPassword[4])
{
	static UINT nConstrols[] = { 
		IDC_EDIT_PWD1,
		IDC_EDIT_PWD2,
		IDC_EDIT_PWD3,
		IDC_EDIT_PWD4 };

	for(int i=0; i<4; i++)
	{
		CString str;
		
		if(GetDlgItemText(nConstrols[i], str) == 0)
			return false;

		// Convert HEX string into DWORD value
		LPTSTR endptr;
		dwPassword[i] = _tcstoul(str, &endptr, 16);

		if(	dwPassword[i] == ULONG_MAX ||
			dwPassword[i] == 0 )
			return false;
	}
	
	return true;
}
コード例 #21
0
// Same, for unsigned long
//
bool XML_PARSER::parse_ulong(const wxChar* start_tag, unsigned long& x) {
    wxChar buf[256], *end;
    bool eof;
    wxChar end_tag[256], tag[256];

    if (_tcscmp(parsed_tag, start_tag)) return false;

    end_tag[0] = wxT('/');
    _tcscpy(end_tag+1, start_tag);

    eof = get(buf, sizeof(buf), is_tag);
    if (eof) return false;
    if (is_tag) {
        if (!_tcscmp(buf, end_tag)) {
            x = 0;      // treat <foo></foo> as <foo>0</foo>
            return true;
        } else {
            return false;
        }
    }
    errno = 0;
    unsigned long val = _tcstoul(buf, &end, 0);
    if (errno) return false;
    if (end != buf+_tcslen(buf)) return false;

    eof = get(tag, sizeof(tag), is_tag);
    if (eof) return false;
    if (!is_tag) return false;
    if (_tcscmp(tag, end_tag)) return false;
    x = val;
    return true;
}
コード例 #22
0
ファイル: add.c プロジェクト: jmalak/reactos
/* Language enumerate procedure */
static BOOL CALLBACK
LanguagesEnumProc(LPTSTR lpLanguage)
{
    LCID Lcid;
    TCHAR Lang[1024];
    INT Index;

    Lcid = _tcstoul(lpLanguage, NULL, 16);

    GetLocaleInfo(Lcid, LOCALE_SLANGUAGE, Lang, sizeof(Lang));
    Index = (INT)SendMessage(hLangList, CB_ADDSTRING,
                             0, (LPARAM)Lang);

    SendMessage(hLangList, CB_SETITEMDATA,
                Index, (LPARAM)Lcid);

    // FIXME!
    if (Lcid == 0x0409)
    {
        SendMessage(hLangList, CB_SELECTSTRING,
                    (WPARAM) -1, (LPARAM)Lang);
    }

    return TRUE;
}
コード例 #23
0
ファイル: UIEdit.cpp プロジェクト: Zhuguoping/directui
void CEditUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
    if( _tcscmp(pstrName, _T("readonly")) == 0 ) SetReadOnly(_tcscmp(pstrValue, _T("true")) == 0);
    else if( _tcscmp(pstrName, _T("password")) == 0 ) SetPasswordMode(_tcscmp(pstrValue, _T("true")) == 0);
    else if( _tcscmp(pstrName, _T("maxchar")) == 0 ) SetMaxChar(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("normalimage")) == 0 ) SetNormalImage(pstrValue);
    else if( _tcscmp(pstrName, _T("hotimage")) == 0 ) SetHotImage(pstrValue);
    else if( _tcscmp(pstrName, _T("focusedimage")) == 0 ) SetFocusedImage(pstrValue);
    else if( _tcscmp(pstrName, _T("disabledimage")) == 0 ) SetDisabledImage(pstrValue);
    else if( _tcscmp(pstrName, _T("nativebkcolor")) == 0 ) 
	{
        if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
        LPTSTR pstr = NULL;
        DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
        SetNativeEditBkColor(clrColor);
    }
	else if (_tcscmp(pstrName, _T("autocompletemode")) == 0) 
	{
		if (_tcscmp(pstrValue, _T("None")) == 0) SetAutoCompleteMode(None);
		else if (_tcscmp(pstrValue, _T("Append")) == 0) SetAutoCompleteMode(Append);
		else if (_tcscmp(pstrValue, _T("Suggest")) == 0) SetAutoCompleteMode(Suggest);
		else if (_tcscmp(pstrValue, _T("SuggestAppend")) == 0) SetAutoCompleteMode(SuggestAppend);
	}
    else CLabelUI::SetAttribute(pstrName, pstrValue);
}
コード例 #24
0
ファイル: NumEdit.cpp プロジェクト: GetEnvy/Envy
/**
 * @param uValue - numeric value.
 */
void CNumEdit::GetValue(UINT32& uValue)
{
	TCHAR szValue[64];
	GetWindowText(szValue, countof(szValue));
	switch (m_eNumFormat)
	{
	case NF_HEX:
		uValue = _tcstoul(szValue, NULL, 16);
		break;
	case NF_DEC:
		uValue = _tcstoul(szValue, NULL, 10);
		break;
	default:
		uValue = 0;
	}
}
コード例 #25
0
ファイル: RemoteSrvPort.cpp プロジェクト: YTYOON/eNVR
void CRemoteSrvPort::vSetRTSPPort2Reg()
{
	CString csPort;
	GetDlgItemText(IDC_EDIT_RTSPSRV_PORT, csPort);

	CRegKey regKey;
	TCHAR szRegValue[1024];
	::ZeroMemory(&szRegValue[0], sizeof(szRegValue));
	const DWORD len = 1024;
	DWORD nActualLen(len);
    CString csForder(CProductDefine::m_tzRegistSubFolder);

	LONG nRet = regKey.Open(HKEY_LOCAL_MACHINE, csForder.GetBuffer());
	if(nRet != ERROR_SUCCESS)
	{
		if( regKey.Create(HKEY_LOCAL_MACHINE, csForder.GetBuffer()) != 0)
		{
			TRACE(_T("Create Registry Fail."));
		}
	}

	DWORD dwRTSPProt = _tcstoul(csPort, 0, 10);
	nRet = regKey.SetDWORDValue(_T("RTSPServerPort"), dwRTSPProt);
	//nRet = regKey.SetValue( csPort.GetBuffer(), _T("REMOTESRVPORT") );
	if(nRet != ERROR_SUCCESS)
	{
		TRACE(_T("Registry SetValue Fail!\r\n"));
	}
	regKey.Close();

	m_nRTSPPort = (int)dwRTSPProt;
	//::AfxBeginThread(iRestartRemoteSrv, NULL);
}
コード例 #26
0
ファイル: lineparse.cpp プロジェクト: kichik/nsis
int LineParser::gettoken_int(int token, int *success/*=0*/) const
{
  token+=m_eat;
  if (token < 0 || token >= m_nt || !m_tokens[token][0])
  {
    if (success) *success=0;
    return 0;
  }
  const TCHAR *p=m_tokens[token], *parse=p;
  TCHAR *end;
  int neg=0, base=0, num;
  if (_T('+') == *p)
    ++p;
  else if (_T('-') == *p)
    ++p, ++neg;
  if (_T('0') == p[0])
  {
    // Special support for 0n, 0y and 0t MASM style and 0b and 0o Python style radix prefix:
    if (_T('n') == (p[1]|32)) parse=&p[2], base=10;
    if (_T('b') == (p[1]|32) || _T('y') == (p[1]|32)) parse=&p[2], base=2;
    if (_T('o') == (p[1]|32) || _T('t') == (p[1]|32)) parse=&p[2], base=8;
  }
  if (neg)
  {
    num=_tcstol(parse,&end,base);
    if (base) num*=-1; // Input was "-0n012" but we have only parsed "012" and need to fix the sign
  }
  else
  {
    num=(int)_tcstoul(parse,&end,base);
  }
  if (success) *success=! (int)(*end);
  return num;
}
コード例 #27
0
ファイル: drives.cpp プロジェクト: HirasawaRUS/encfs4win
boost::shared_ptr<Drive> Drive::Load(const std::string& name)
{
	boost::shared_ptr<Drive> ret;
	std::tstring dir, drive, pid;
	try {
		dir = Config::Load(name, _T("Directory"));
		drive = Config::Load(name, _T("Drive"));
		pid = Config::Load(name, _T("Pid"));
	}
	catch(const truntime_error&) {
		// ignore
	}

	// check values readed
	char c = 0;
	if (!drive.empty()) c = toupper(drive[0]);
	if (c < 'C' || c > 'Z') {
		Config::Delete(name);
		return ret;
	}

	// handle resume
	unsigned n = _tcstoul(pid.c_str(), NULL, 10);
	TCHAR mnt[4];
	_stprintf(mnt, _T("%c:\\"), c);
	if (n <= 0 || GetDriveType(mnt) == DRIVE_NO_ROOT_DIR)
		n = 0;

	ret.reset(new Drive(name, dir, c, n));
	return ret;
}
コード例 #28
0
static unsigned long AToULong(const TCHAR* psz, const TCHAR** ppszEnd, bool* pbRange)
{
    unsigned long ulVal;

    errno = 0;

    if(psz[0]== _T('0') && (psz[1]== _T('x') || psz[1]== _T('X')))
        ulVal = _tcstoul(psz, (TCHAR**)ppszEnd, 16);
    else
        ulVal = _tcstoul(psz, (TCHAR**)ppszEnd, 10);

    if(pbRange)
        *pbRange = errno==ERANGE;

    return ulVal;
}
コード例 #29
0
ファイル: Main.cpp プロジェクト: localvar/backup
static void LoadInternalExceptionList()
{
	g_aException.SetCount( 0, 32 );

	LPCTSTR rs = NULL;
	size_t len = AtlLoadString(
		IDS_INTERNAL_EXCEPTIONS,
		reinterpret_cast<LPTSTR>(&rs),
		0
		);

	LPTSTR buf = reinterpret_cast<LPTSTR>( malloc((len + 1) * sizeof(TCHAR)) );
	_tcsncpy( buf, rs, len );
	buf[len] = 0;

	LPCTSTR p = _tcstok( buf, _T("|") );
	while( p != NULL )
	{
		CExceptionInfo ei;
		ei.bUser = false;
		ei.bFiltered = false;
		ei.dwCode = _tcstoul( p, NULL, 0 );
		p = _tcstok( NULL, _T("|") );
		_tcsncpy( ei.szName, p, _countof(ei.szName) );
		ei.szName[_countof(ei.szName) - 1] = 0;
		g_aException.Add( ei );
		p = _tcstok( NULL, _T("|") );
	}

	free( buf );
}
コード例 #30
0
ファイル: intl.c プロジェクト: RPG-7/reactos
VOID
ParseSetupInf(VOID)
{
    INFCONTEXT InfContext;
    TCHAR szBuffer[30];

    if (!SetupFindFirstLine(hSetupInf,
                            _T("Unattend"),
                            _T("LocaleID"),
                            &InfContext))
    {
        SetupCloseInfFile(hSetupInf);
        DPRINT1("SetupFindFirstLine failed\n");
        return;
    }

    if (!SetupGetStringField(&InfContext, 1, szBuffer,
                             sizeof(szBuffer) / sizeof(TCHAR), NULL))
    {
        SetupCloseInfFile(hSetupInf);
        DPRINT1("SetupGetStringField failed\n");
        return;
    }

    UnattendLCID = _tcstoul(szBuffer, NULL, 16);
    IsUnattendedSetupEnabled = 1;
    SetupCloseInfFile(hSetupInf);
}