Example #1
0
void CCommonAppUtils::SetWindowTitle( HWND hWnd, const CString& urlorpath, const CString& dialogname )
{
#define MAX_PATH_LENGTH 80
    ASSERT(dialogname.GetLength() < MAX_PATH_LENGTH);
    WCHAR pathbuf[MAX_PATH] = {0};
    if (urlorpath.GetLength() >= MAX_PATH)
    {
        std::wstring str = (LPCTSTR)urlorpath;
        std::wregex rx(L"^(\\w+:|(?:\\\\|/+))((?:\\\\|/+)[^\\\\/]+(?:\\\\|/)[^\\\\/]+(?:\\\\|/)).*((?:\\\\|/)[^\\\\/]+(?:\\\\|/)[^\\\\/]+)$");
        std::wstring replacement = L"$1$2...$3";
        std::wstring str2 = std::regex_replace(str, rx, replacement);
        if (str2.size() >= MAX_PATH)
            str2 = str2.substr(0, MAX_PATH-2);
        PathCompactPathEx(pathbuf, str2.c_str(), MAX_PATH_LENGTH-dialogname.GetLength(), 0);
    }
    else
        PathCompactPathEx(pathbuf, urlorpath, MAX_PATH_LENGTH-dialogname.GetLength(), 0);
    CString title;
    switch (DWORD(CRegStdDWORD(L"Software\\TortoiseSVN\\DialogTitles", 0)))
    {
    case 0: // url/path - dialogname - appname
        title  = pathbuf;
        title += L" - " + dialogname + L" - " + CString(MAKEINTRESOURCE(IDS_APPNAME));
        break;
    case 1: // dialogname - url/path - appname
        title = dialogname + L" - " + pathbuf + L" - " + CString(MAKEINTRESOURCE(IDS_APPNAME));
        break;
    }
    SetWindowText(hWnd, title);
}
Example #2
0
void CDlgCfgAlarm::InitDlg(BOOL bShow /* = TRUE */)
{
	if (!bShow)
	{
		memset(&m_stuInfo, 0, sizeof(m_stuInfo));
	}

	int i = 0;
	int nChannelNum = m_uiAlarmIn == 0 ? 16 : m_uiAlarmIn;

	// channel
	m_cmbChn.ResetContent();
	for (i = 0; i < nChannelNum; i++)
	{
		CString csItem;
		csItem.Format("%s %02d", ConvertString("Channel", DLG_CFG_ALARM), i + 1);
		m_cmbChn.InsertString(-1, csItem);
	}
	m_cmbChn.SetCurSel(m_stuInfo.nChannelID);

	// bypass
	m_chkByPass.SetCheck(m_stuInfo.bEnable ? BST_UNCHECKED : BST_CHECKED);

	// defence_area_type
	m_cmbAreaType.ResetContent();
	for (i = 0; i < sizeof(stuDemoAreaType) / sizeof(stuDemoAreaType[0]); i++)
	{
		m_cmbAreaType.InsertString(-1, ConvertString(stuDemoAreaType[i].pszName, DLG_CFG_ALARM));
	}
	m_cmbAreaType.SetCurSel((int)m_stuInfo.emDefenceAreaType);

	// disable delay
	SetDlgItemInt(IDC_CFG_ALARM_EDT_DIS_DELAY, m_stuInfo.nDisDelay, FALSE);

	// enable delay
	SetDlgItemInt(IDC_CFG_ALARM_EDT_ENA_DELAY, m_stuInfo.nEnableDelay, FALSE);

	// name
	SetDlgItemText(IDC_CFG_ALARM_EDT_NAME, m_stuInfo.szChnName);

	// sensor type: nc or no
	m_cmbSensorType.ResetContent();
	m_cmbSensorType.InsertString(-1, ConvertString("NC", DLG_CFG_ALARM));
	m_cmbSensorType.InsertString(-1, ConvertString("NO", DLG_CFG_ALARM));
	m_cmbSensorType.SetCurSel(m_stuInfo.nAlarmType);

	// sensor method...to be
	m_cmbSensorMethod.ResetContent();
	for (i = 0; i < sizeof(stuDemoSenseMethod) / sizeof(stuDemoSenseMethod[0]); i++)
	{
		m_cmbSensorMethod.InsertString(-1, ConvertString(stuDemoSenseMethod[i].pszName, DLG_CFG_ALARM));
	}
	m_cmbSensorMethod.SetCurSel(int(m_stuInfo.emSense));
	
	// slot

	// level1

	// level2
}
Example #3
0
BOOL CDlgCfgAlarm::GetConfigFromDevice()
{
	char szJsonBuf[1024 * 40] = {0};
	int nerror = 0;
	int nSelChn = m_cmbChn.GetCurSel() == -1 ? 0 : m_cmbChn.GetCurSel();
	BOOL bRet = CLIENT_GetNewDevConfig((LLONG)m_hLoginID, CFG_CMD_ALARMINPUT, nSelChn, szJsonBuf, 1024*40, &nerror, SDK_API_WAIT);

	if (bRet)
	{
		DWORD dwRetLen = 0;
		bRet = CLIENT_ParseData(CFG_CMD_ALARMINPUT, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen);
		if (!bRet)
		{
			MessageBox(ConvertString(CString("parse Alarm error..."), DLG_CFG_ALARM), ConvertString("Prompt"));
			return FALSE;
		}
	}
	else
	{			
		CString csErr;
		csErr.Format("%s %08x...\r\n\r\n%s", ConvertString("QueryConfig Alarm error:", DLG_CFG_ALARM),
			CLIENT_GetLastError(), szJsonBuf);
		MessageBox(csErr, ConvertString("Prompt"));
		return FALSE;
	}
	return TRUE;
}
Example #4
0
CString ExtractKeyword(CString line) // "  function(..)     " will return "function"
{
	int length = line.GetLength();
	int start = -1;
	int end = length;

	for(int a = 0; a < length; a++)
	{
		if(KeywordLetter(line.GetAt(a)))
		{
			start = a;
			a = length;
		}
	}

	if(start == -1)
		return CString("");

	for(int a = start; a < length; a++)
	{
		if(!KeywordLetter(line.GetAt(a)))
		{
			end = a;
			a = length;
		}
	}
	return line.Mid(start, end-start);
}
// 关闭并结束线程
//************************************
// Method:    OnClose
// FullName:  CThreadManage::OnClose
// Access:    public 
// Returns:   void
// Qualifier:
// Parameter: void
//************************************
void CThreadManage::OnClose(void)
{
	int iResult = 0;
	CString str = _T("");

	m_oHeartBeatThread.OnClose();
	m_oADCDataRecThread.OnClose();
	iResult = WaitForSingleObject(m_oHeartBeatThread.m_hHeartBeatThreadClose, WaitForThreadCloseTime);
	if (iResult != WAIT_OBJECT_0)
	{
		str.Format(_T("心跳线程在%dms内未能正常结束!"), WaitForThreadCloseTime);
		AfxMessageBox(str);
	}

	iResult = WaitForSingleObject(m_oADCDataRecThread.m_hADCDataThreadClose, WaitForThreadCloseTime);
	if (iResult != WAIT_OBJECT_0)
	{
		str.Format(_T("ADC数据接收线程在%dms内未能正常结束!"), WaitForThreadCloseTime);
		AfxMessageBox(str);
	}
	
	m_oHeadFrameSocket.Close();
	m_oIPSetSocket.Close();
	m_oTailFrameSocket.Close();
	m_oTailTimeFrameSocket.Close();
	m_oSysTimeSocket.Close();
	m_oADCSetSocket.Close();
	m_oHeartBeatSocket.Close();
	m_oADCDataSocket.Close();
	m_oInstrumentList.OnClose();
}
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 #7
0
CString CRegistry::GetString(LPCTSTR pszSection, LPCTSTR pszName, LPCTSTR pszDefault, LPCTSTR pszSubKey, BOOL bIgnoreHKCU)
{
	CString strSection( pszSubKey ? pszSubKey : _T("Software\\PeerProject\\PeerProject") );
	if ( pszSection && *pszSection )
	{
		if ( pszSection[0] != _T('\\') )
			strSection += _T("\\");
		strSection += pszSection;
	}

	// Read from HKCU then from HKLM
	DWORD nType = 0, nSize = 0;
	LONG nErrorCode = SHRegGetUSValue( (LPCTSTR)strSection, pszName, &nType,
		NULL, &nSize, bIgnoreHKCU, NULL, 0 );
	if ( nErrorCode == ERROR_SUCCESS && nType == REG_SZ && nSize >= sizeof( TCHAR ) && ( nSize & 1 ) == 0 )
	{
		CString strValue;
		nErrorCode = SHRegGetUSValue( (LPCTSTR)strSection, pszName, &nType,
			strValue.GetBuffer( nSize / sizeof( TCHAR ) ), &nSize, bIgnoreHKCU, NULL, 0 );
		strValue.ReleaseBuffer( nSize / sizeof( TCHAR ) - 1 );
		if ( nErrorCode == ERROR_SUCCESS )
			return strValue;
	}

	return pszDefault ? CString( pszDefault ) : CString();
}
Example #8
0
void CThread::DelFiles(CString sFolder)
{
	if ((GetFileAttributes(sFolder.C()) & FILE_ATTRIBUTE_DIRECTORY) == 0)
	{
		DeleteFile(sFolder.C());
		return;
	}

	HANDLE hFind = NULL;
	WIN32_FIND_DATA dFind;

	CString sFindFolder = sFolder + TEXT("\\*");
	if ((hFind = FindFirstFile(sFindFolder.C(), &dFind)) != INVALID_HANDLE_VALUE)
	{
		do
		{
			if (lstrcmp(dFind.cFileName, TEXT(".")) == 0 ||
				lstrcmp(dFind.cFileName, TEXT("..")) == 0)
				continue;

			DelFiles(sFolder + TEXT("\\") + dFind.cFileName);
		} while (FindNextFile(hFind, &dFind) != 0);

		FindClose(hFind);
	}

	RemoveDirectory(sFolder.C());
	return;
}
Example #9
0
void CServerDlg::DefaultInit()
{
    // Add "About..." menu item to system menu.

    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
        }
    }

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);			// Set big icon
    SetIcon(m_hIcon, FALSE);		// Set small icon
}
Example #10
0
void CDialogAtoms::ShowContextHelp(CWnd *pWnd, POINT pt, int iCtrlID)
{
CString s;

 // Загружаем текст помощи из String Table
 if(s.LoadString(iCtrlID))
 {
  HH_POPUP hPop; // структура всплывающей HTML справки

  // Инициализируем структуру знаками NULL (нулями)	
  memset(&hPop, 0, sizeof(hPop)); 

  // Устанавливаем размер структуры
  hPop.cbStruct         = sizeof(hPop);		

  // Цвет фона - жёлтый
  hPop.clrBackground    = RGB(255, 255, 255);	

  hPop.clrForeground    = -1; // Font color	
  hPop.rcMargins.left   = 10;
  hPop.rcMargins.bottom = 10;
  hPop.rcMargins.right  = 10;
  hPop.rcMargins.top  = 5;
  hPop.pt               = pt;
  hPop.pszText          = s; // Текст из String Table
  hPop.pszFont          = NULL; // Шрифт
    
#ifndef _WIN64
  ::HtmlHelpA(pWnd->GetSafeHwnd(), NULL, HH_DISPLAY_TEXT_POPUP, (DWORD)&hPop);
#endif
 } // Если строка справки для данного запроса найдена, то завершаем

}
Example #11
0
DWORD CThread::FilesInFolder(CString scFolder)
{
	HANDLE hFind = NULL;
	WIN32_FIND_DATA dFind;

	DWORD res = 0;

	// Ищем все файлы\папки в переданной папке
	CString sFolder = scFolder + TEXT("\\*");
	if ((hFind = FindFirstFile(sFolder.C(), &dFind)) != INVALID_HANDLE_VALUE)
	{
		do
		{
			// Если прервали выполнение - выход из цикла
			if (IsTerminated()) break;

			// Пропускаем специальные папки '.' и '..'
			if (lstrcmp(dFind.cFileName, TEXT(".")) == 0 ||
				lstrcmp(dFind.cFileName, TEXT("..")) == 0)
				continue;

			if ((dFind.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
				res++;

		} while (FindNextFile(hFind, &dFind) != 0);

		FindClose(hFind);
	}

	return res;
}
Example #12
0
void textelite_get(CString& cszText)
{
   std::string str(g_vecPrintfText.begin(), g_vecPrintfText.end());
   cszText = str.c_str();
   cszText.TrimLeft(_T("\r\n"));
   cszText.TrimRight();
}
Example #13
0
CString CGenethonDoc::ConvertPathname( const char *nExt )
{
    char *pName;
    CString PathName = GetPathName();

    int NameLen = PathName.GetLength();

    pName = PathName.GetBuffer(NameLen);

    int tLen = NameLen - 1;
    int i;
    for ( i = 0; i < 4; ++i ) {
        if ( pName[tLen] == '.' ) {
            break;
        }
        tLen--;
    }

    if ( pName[tLen] == '.' ) {
        i = 0;
        while ( (tLen < NameLen) && (i < 4) ) {
            pName[tLen] = nExt[i];
            i++;
            tLen++;
        }
        PathName.ReleaseBuffer();
    } else {
        PathName.ReleaseBuffer();
        PathName += nExt;
    }

    return PathName;
}
Example #14
0
void
CGenethonDoc::GetProjectType()
{

    int tType = 0, rc;

    if (pGSFiller != NULL) {
        if (!pGSFiller->SegHeaderList.IsEmpty()) {

            CString *cStr = (CString *)pGSFiller->SegHeaderList.GetTail();
            // Looking for Master Checksum location ...

            if ((rc = cStr->Find("Type: ")) != -1) {
                const char *rStr = (const char *)*cStr;
                rStr += rc + strlen("Type: ");
                if (*rStr == 'N') {
                    tType = 1;
                }
            }
        }
    }


    m_UserVars.m_ProjectType = tType + 1;
}
Example #15
0
void Rectan::ViewProperties()
{
	CString str;
	CMainFrame *pMainWnd = CMainFrame::GetCMF();
	pMainWnd->RemoveProperties();
	pMainWnd->AddPropertiesCategory();
	pMainWnd->AddPropertiesPanel(_T("Coordinates"));

	//
	CMFCRibbonEdit* EditBox1 = new CMFCRibbonEdit(ID_INFO1, 50,_T("x1"), -1);
	str.Format(_T("%d"), m_x1);
	EditBox1->SetEditText(str);
	pMainWnd->Add(EditBox1, 0);

	CMFCRibbonEdit* EditBox2 = new CMFCRibbonEdit(ID_INFO2, 50,_T("y1"), -1);
	str.Format(_T("%d"), m_y1);
	EditBox2->SetEditText(str);
	pMainWnd->Add(EditBox2, 0);

	CMFCRibbonEdit* EditBox3 = new CMFCRibbonEdit(ID_INFO3, 50,_T("x2"), -1);
	str.Format(_T("%d"), m_x2);
	EditBox3->SetEditText(str);
	pMainWnd->Add(EditBox3, 0);

	CMFCRibbonEdit* EditBox4 = new CMFCRibbonEdit(ID_INFO4, 50,_T("y2"), -1);
	str.Format(_T("%d"), m_y2);
	EditBox4->SetEditText(str);
	pMainWnd->Add(EditBox4, 0);
}
Example #16
0
void CBaseConfigPage::OnBnClickedButton3()
{
	m_bChangeProcess=true;
	CString strLeftString;
	int iRightCurIndex;
	CString strMsg;
	m_listProcessAll.GetText(m_listProcessAll.GetCurSel(),strLeftString);
	if((m_listProcessEnable.FindString(0,strLeftString))!=-1)
	{
		  strMsg.Format("%s has already in right list box. Are you sure duplicate the process?",strLeftString);
		  if(MessageBox(strMsg,"Warning",MB_YESNO)==IDYES)
		  {
			 iRightCurIndex=m_listProcessEnable.GetCurSel();
			m_listProcessEnable.InsertString(iRightCurIndex+1,strLeftString);
			m_listProcessAll.SetCurSel(m_listProcessAll.GetCurSel()+1);
			m_listProcessEnable.SetCurSel(iRightCurIndex+1); 
		  }
	}
	else
	{   
		iRightCurIndex=m_listProcessEnable.GetCurSel();
		m_listProcessEnable.InsertString(iRightCurIndex+1,strLeftString);
		m_listProcessAll.SetCurSel(m_listProcessAll.GetCurSel()+1);
		m_listProcessEnable.SetCurSel(iRightCurIndex+1);
	}
}
Example #17
0
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 #18
0
bool CThTesting::InitialConnect()
{
	if(!m_Interface.IsOpen())
	{

		CTcpInterfaceDlg *p = (CTcpInterfaceDlg *) theApp.m_pMainWnd;

		//CString IpAddress = "192.168.10.201";
		//CString IpAddress = "127.0.0.1";
		//CString IpAddress = "192.168.206.10";

		CString IpAddress = p->getIpAddress();

		int m_iPort = 7211 + m_iID;

		if(!m_Interface.Open(IpAddress.GetBuffer(IpAddress.GetLength()), m_iPort))
			return FALSE;

// 		CString cs, csSendText;
// 		csSendText.Format("((SLT2_START=S-305, %d))", m_iID+1);
// 
// 
// 		m_Interface.WriteString(csSendText.GetBuffer(csSendText.GetLength()), csSendText.GetLength());
// 
// 		cs.Format("%3d S:%s", m_iID+1, csSendText);
// 		if(p->GetSafeHwnd() != NULL) p->AddString(cs.GetBuffer(cs.GetLength()));
	}
	else
	{
		m_Interface.Close();
		return false;
	}

	return true;
}
void CCollectionCreateDialog::AddSelectedFiles(void)
{
	CTypedPtrList<CPtrList, CKnownFile*> knownFileList;
	POSITION pos = m_CollectionAvailListCtrl.GetFirstSelectedItemPosition();
	while (pos != NULL)
	{
		int index = m_CollectionAvailListCtrl.GetNextSelectedItem(pos);
		if (index >= 0)
			knownFileList.AddTail((CKnownFile*)m_CollectionAvailListCtrl.GetItemData(index));
	}

	while (knownFileList.GetCount() > 0)
	{
		CAbstractFile* pAbstractFile = knownFileList.RemoveHead();
		CCollectionFile* pCollectionFile = m_pCollection->AddFileToCollection(pAbstractFile, true);
		if (pCollectionFile)
			m_CollectionListCtrl.AddFileToList(pCollectionFile);
	}

	CString strTitle;
	strTitle.Format(GetResString(IDS_COLLECTIONLIST) + _T(" (%u)"), m_CollectionListCtrl.GetItemCount());
	m_CollectionListLabel.SetWindowText(strTitle);

	GetDlgItem(IDC_CCOLL_SAVE)->EnableWindow(m_CollectionListCtrl.GetItemCount() > 0);
}
TEST_F(EWK2DownloadJobTest, ewk_download)
{
    OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
    httpServer->run(serverCallback);

    // Generate unique name for destination file.
    char destinationPath[] = "/tmp/pdf-file.XXXXXX";
    ASSERT_TRUE(mktemp(destinationPath));

    CString fileUrl = httpServer->getURLForPath(testFilePath);

    DownloadTestData userData = { fileUrl.data(), destinationPath };
    ASSERT_FALSE(fileExists(destinationPath));

    evas_object_smart_callback_add(webView(), "download,request", on_download_requested, &userData);
    evas_object_smart_callback_add(webView(), "download,cancel", on_download_cancelled, &userData);
    evas_object_smart_callback_add(webView(), "download,failed", on_download_failed, &userData);
    evas_object_smart_callback_add(webView(), "download,finished", on_download_finished, &userData);

    // Download test pdf
    ewk_view_url_set(webView(), fileUrl.data());
    ecore_main_loop_begin();

    // Clean up
    unlink(destinationPath);
}
Example #21
0
BOOL CProfiles::Setup()
{
    Release();

    CSingleLock pLock( &m_pSection, TRUE );

    CString strXML;

    strXML = Settings.General.Path;
    int nLength = strXML.GetLength();

    if ( nLength > 0 && strXML.GetAt(nLength-1) != '\\' ) strXML += '\\';
    strXML += _T("xProfile.xml");

    if ( CXMLElement* pXML = CXMLElement::FromFile( strXML, TRUE ) )
    {
        CXMLElement* pXMLSub;

        if ( pXMLSub = pXML->GetElementByName( _T("Monitor") ) )
        {
            m_pXMLMonitor = pXMLSub->Clone();
        }

        delete pXML;
        return TRUE;
    }

    return FALSE;
}
void CEditPropExternalsValue::OnBnClickedShowLog()
{
    UpdateData(TRUE);
    if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
        return;
    CString urlString = m_URLCombo.GetString();
    CTSVNPath logUrl = m_URL;
    if (urlString.GetLength()>1)
    {
        logUrl = CTSVNPath(SVNExternals::GetFullExternalUrl(urlString, m_RepoRoot.GetSVNPathString(), m_URL.GetSVNPathString()));
    }
    else
    {
        logUrl = m_RepoRoot;
        logUrl.AppendPathString(urlString);
    }

    if (!logUrl.IsEmpty())
    {
        delete m_pLogDlg;
        m_pLogDlg = new CLogDlg();
        m_pLogDlg->SetSelect(true);
        m_pLogDlg->m_pNotifyWindow = this;
        m_pLogDlg->m_wParam = 0;
        m_pLogDlg->SetParams(CTSVNPath(logUrl), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, TRUE);
        m_pLogDlg->ContinuousSelection(true);
        m_pLogDlg->Create(IDD_LOGMESSAGE, this);
        m_pLogDlg->ShowWindow(SW_SHOW);
    }
    AfxGetApp()->DoWaitCursor(-1);
}
Example #23
0
void CScriptDlg::InitPythonForObjects()
{
	if(pApp == NULL)
		return;


	POSITION pos = pApp->object_types.GetStartPosition();
	CObjType* oT;
	long nKey = 0;
	int objectnumber = 0;
	while (pos != NULL) 
	{	
		pApp->object_types.GetNextAssoc(pos, nKey, oT);
		if(oT && !oT->m_bIsGroupType)
		{
			CString name = oT->GetName();
			name.Replace("&", "");
			PyInfoClass* pClass = &m_Intell.classes[name];
			InitPythonForObject(oT, pClass);

			PyInfoMapItem& item = m_IntellMap[name];
			item[&m_Intell] = PY_CLASS;
		}
	}

	// System
	oT = &pApp->m_System;
	PyInfoClass* pClass = &m_Intell.classes[oT->GetName()];
	InitPythonForObject(oT, pClass);

	PyInfoMapItem& item = m_IntellMap[oT->GetName()];
	item[&m_Intell] = PY_CLASS;
}
BOOL KSceneSFXEditorLauncherSelectDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO:  Add extra initialization here
    m_listLauncher.InsertColumn(0, _T("·¢ÉäÆ÷ÁÐ±í£º"),	LVCFMT_CENTER, 150);

    m_listLauncher.SetExtendedStyle(
        m_listLauncher.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES
    );

    ASSERT(m_pSFX);

    DWORD dwLauncherNum = m_pSFX->GetParticleLauncherNum();
    m_listLauncher.DeleteAllItems();
    while (dwLauncherNum > 0)
    {
        dwLauncherNum--;

        CString str;
        str.Format("·¢ÉäÆ÷%d", dwLauncherNum + 1);
        m_listLauncher.InsertItem(0, str);
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
void CProcessWatchThread::SetConfig(CString path, LPCTSTR lpszEXE)
{
	strEXE = lpszEXE;
	m_strPath = path;
	int idx = path.ReverseFind(_T('\\'));
	strDLL = path.Right(path.GetLength() - idx - 1);
}
Example #26
0
bool CIVConnection::HttpError(HINTERNET hFile, DWORD dwStatus)
{
	if (dwStatus == HTTP_STATUS_OK)
		return false;
	
	CString strError;
	CString strStatus;
	QueryStatusText (hFile, strStatus);

	switch (dwStatus)
	{
	case HTTP_STATUS_SERVER_ERROR:
		strError.LoadString (ERR_IDS_HTTP_INTERNAL);
		break;
	case HTTP_STATUS_NOT_FOUND:
		strError.LoadString (ERR_IDS_HTTP_NOT_FOUND);
		break;
	default:
		strError.Format (ERR_IDS_HTTP_ERROR, dwStatus, (LPCTSTR) strStatus);
	}

	SetError (  GetCommonIVError(strError) );

	return true;
}
Example #27
0
BOOL CDlgCfgAlarm::SetConfigToDevice()
{	
	char szJsonBuf[1024 * 40] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_ALARMINPUT, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet Alarm error..."), DLG_CFG_ALARM), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{		
		int nSelChn = m_cmbChn.GetCurSel() == -1 ? 0 : m_cmbChn.GetCurSel();
		int nerror = 0;
		int nrestart = 0;
		
		bRet = CLIENT_SetNewDevConfig((LLONG)m_hLoginID, CFG_CMD_ALARMINPUT, nSelChn, szJsonBuf, 1024*40, &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig Alarm failed:", DLG_CFG_ALARM), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig Alarm ok!"), DLG_CFG_ALARM), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
TEST(CStringUtils, RemoveAccelerators)
{
	CString empty;
	CStringUtils::RemoveAccelerators(empty);
	EXPECT_TRUE(empty.IsEmpty());

	CString text1 = L"&Accellerator";
	CStringUtils::RemoveAccelerators(text1);
	EXPECT_STREQ(L"Accellerator", text1);

	CString text1a = L"Ac&cellerator";
	CStringUtils::RemoveAccelerators(text1a);
	EXPECT_STREQ(L"Accellerator", text1a);

	CString text2 = L"Accellerator&";
	CStringUtils::RemoveAccelerators(text2);
	EXPECT_STREQ(L"Accellerator", text2);

	CString text3 = L"Some & text";
	CStringUtils::RemoveAccelerators(text3);
	EXPECT_STREQ(L"Some & text", text3);

	CString text4 = L"&&Accellerator";
	CStringUtils::RemoveAccelerators(text4);
	EXPECT_STREQ(L"&Accellerator", text4);

	CString text5 = L"Acce&&&llerator";
	CStringUtils::RemoveAccelerators(text5);
	EXPECT_STREQ(L"Acce&llerator", text5);

	CString text6 = L"Some & te&xt";
	CStringUtils::RemoveAccelerators(text6);
	EXPECT_STREQ(L"Some & text", text6);
}
Example #29
0
CString CPhrasesUnitsFrame::GetSQL()
{
	CString sql;
	sql.Format(_T("SELECT * FROM PHRASES WHERE BOOKID=%d AND UNIT*10+PART>=%d AND UNIT*10+PART <=%d"), 
		m_lbuSettings.nBookID, m_lbuSettings.GetUnitPartFrom(), m_lbuSettings.GetUnitPartTo());
	return sql;
}
Example #30
0
bool CCommonAppUtils::AddClipboardUrlToWindow( HWND hWnd )
{
    if (IsClipboardFormatAvailable(CF_UNICODETEXT))
    {
        CClipboardHelper clipboard;
        clipboard.Open(hWnd);
        HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT);
        if (hglb)
        {
            LPCWSTR lpstr = (LPCWSTR)GlobalLock(hglb);
            CString sUrl = lpstr;
            GlobalUnlock(hglb);

            sUrl.Trim();
            CString sLowerCaseUrl = sUrl;
            sLowerCaseUrl.MakeLower();
            // check for illegal chars: they might be allowed in a regular url, e.g. '?',
            // but not in an url to an svn repository!
            if (sLowerCaseUrl.FindOneOf(L"\n\r?;=+$,<>#") >= 0)
                return false;

            if ((sLowerCaseUrl.Find(L"http://")==0) ||
                (sLowerCaseUrl.Find(L"https://")==0) ||
                (sLowerCaseUrl.Find(L"svn://")==0) ||
                (sLowerCaseUrl.Find(L"svn+ssh://")==0) ||
                (sLowerCaseUrl.Find(L"file://")==0))
            {
                ::SetWindowText(hWnd, (LPCTSTR)sUrl);
                return true;
            }
        }
    }
    return false;
}