示例#1
0
BOOL CFanmotorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
   	
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	aboutdlg = NULL;
	debugdlg = NULL;
	detaildlg = NULL;
	otpdlg = NULL;
	otpcaldlg = NULL;
	evaluationdlg = NULL;
	testdlg = NULL;
	inttest = NULL;
	
	//CFanmotorDlg* pParent = (CFanmotorDlg*)m_pParent;
	//*****************************************************
	/* set virtual_board=false for read back IC reg value.
	set virtual_board=true for read back virtual reg value.*/
	virtual_board=false;
	fOTP=0;
	//*****************************************************
		if(virtual_board==true)
		InitVirtualBoard();


    m_EDIT_ADDR.SetWindowText(_T("92"));
	m_EDIT_SCL_FREQ.Format(_T("400kHz"));
	UpdateData(FALSE);
	//m_EDIT_PWM_FREQ.Format(_T("25kHz"));
	//UpdateData(FALSE);
	m_EDIT_PWM_DC.Format(_T("%.0f%s"),duty_cycle1,"%");
	UpdateData(FALSE);
	m_EDIT_PWM_DC2.Format(_T("%d%s"),duty_cycle2,"%");
	UpdateData(FALSE);

	m_EDIT_MODE.Format(_T("ON"));
	UpdateData(FALSE);
	m_CHECK_MODE.SetCheck(1);
	//OnBnClickedButtonStart();
	

	linkupbridge();
	Sleep(1000);
	CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);//?

	//linkupdevice();

	return TRUE;  // return TRUE  unless you set the focus to a control
}
示例#2
0
static void SelectString( CListBox &list, const RString &sToSelect )
{
	for( int i=0; i<list.GetCount(); i++ )
	{
		CString s;
		list.GetText( i, s );
		if( s == sToSelect )
		{
			list.SetCurSel( i );
			break;
		}
	}
}
示例#3
0
void CPhotoProjectsTypeDlg::BuildList(void)
{
	/*
	// Get the name to match.
	*/

	CString csOldName;
	if (m_pOldInfo != NULL)
	{
		csOldName = m_pOldInfo->GetName();
	}

	int nNewSel = 0;
	CListBox* pList;

	if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL)
	{
		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nPhotoPrjs = m_List.PhotoProjects();
		for (int nPhotoPrj = 0; nPhotoPrj < nPhotoPrjs; nPhotoPrj++)
		{
			CPhotoPrjData* pPhotoPrj = (CPhotoPrjData*)m_List.PhotoProject(nPhotoPrj);
			ASSERT(pPhotoPrj != NULL);

			int nIndex = pList->AddString(pPhotoPrj->m_pSubAreaData[0]->GetName());
			if (nIndex >= 0)
			{
				pList->SetItemData(nIndex, (DWORD)pPhotoPrj);

				if (pPhotoPrj->m_pSubAreaData[0]->GetName() == csOldName)
				{
					nNewSel = nIndex;
				}
			}
		}

	/*
	// Set the initial entry as necessary.
	*/

		if (pList->GetCount() > 0)
		{
			pList->SetCurSel(nNewSel);
			OnSelchangePhotoProjectsList();
		}
		pList->SetRedraw(TRUE);
	}


}
示例#4
0
bool CFanmotorDlg::GetActiveBridge(CString& BridgeID)
{
    CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	BridgeID = L"";
	if (listBoxBridges->GetCurSel() < 0) 
	{
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active BRIDGE!");
		return false;
	}
    CBridgeInfo* bridgeInfo = (CBridgeInfo*)listBoxBridges->GetItemDataPtr(listBoxBridges->GetCurSel());
	BridgeID = bridgeInfo->BridgeID;
	return true;
}
示例#5
0
void CEnvelopeTypeDialog::BuildList(void)
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL)
	{
		/*
		// Get the name to match.
		*/

		CString csOldName;
		if (m_pOldInfo != NULL)
		{
			csOldName = m_pOldInfo->GetName();
		}

		int nNewSel = 0;

		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nLabels = m_List.Labels();
		for (int nLabel = 0; nLabel < nLabels; nLabel++)
		{
			CLabelData* pLabel = m_List.Label(nLabel);
			ASSERT(pLabel != NULL);

			if (pLabel != NULL)
			{
				int nIndex = pList->AddString(pLabel->GetName());
				if (nIndex >= 0)
				{
					pList->SetItemData(nIndex, (DWORD)pLabel);
				/*
				// If the label matches the name coming in,
				// remember its position.
				*/
					if (pLabel->GetName() == csOldName)
					{
						nNewSel = nIndex;
					}
				}
			}
		}
		// Always start with the first label.
		pList->SetCurSel(nNewSel);
		pList->SetRedraw(TRUE);

		OnSelchangeEnvelopeList();				// Do this by hand.
	}
}
示例#6
0
void CFanmotorDlg::ErrorMsg(int r) 
{
	CString msg = Bridge->GetStatusMsg(r);
    AfxMessageBox(msg, MB_ICONERROR | MB_OK, 0);
    if (r == 7) // If device is busy by another application
    {
		CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
		listBoxBridges->SetCurSel(-1);
		CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
        listBoxDevices->ResetContent();
	//	ResetPowerSettings();
	//	ResetSpeedSettings();
        Bridge->AbortTransfer(); // Deactivate any Bridge (free port handle)
    }
}
void
ArxDbgUtils::fillListBox(const SdStrList& slist, CListBox& lb, int defIndex)
{
    BOOL addedOne = FALSE;

    lb.ResetContent();
    SdStrListIterator iter(slist);
    for(; !iter.done(); iter.next()) {
        addedOne = TRUE;
        lb.AddString(iter.item());
    }

    if ( addedOne )
        lb.SetCurSel(defIndex);
}
示例#8
0
void CDizzyDialog::OnAddButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	CAxisRotation inputRotation;
	bool bValidString = inputRotation.ParseString(m_strInput);
	if (bValidString) {
		int iOffset = pListBox->GetCurSel();
		if (iOffset != LB_ERR) {
			pListBox->InsertString(iOffset+1,m_strInput);
			pListBox->SetCurSel(iOffset+1);
		}	
		else {
			pListBox->AddString(m_strInput);
			pListBox->SetCurSel(pListBox->GetCount()-1);
		}
		RecalculateRotation();
		m_strInput = "";
		UpdateData(false);
	}
	else {
		::AfxMessageBox("Input must be a valid axis-angle rotation!");
	}
}
示例#9
0
void CFanmotorDlg::linkupdevice()
{
	//CString BridgeID;
    CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	
	setpower5v();
	setspeed400k();
/*	setpower3v();

	if (GetActiveBridge(BridgeID))
	{
		CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
		listBoxBridges->ResetContent();
		SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
		VARIANT data = Bridge->GetDeviceList(BridgeID);
		SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
		//Process Result
		int lastError = Bridge->GetBridgeStatus(1);
		if (lastError != 34) // failure of bus scanning
			ErrorMsg(lastError);
		else // bus scanned successfully
		{
			SAFEARRAY FAR *List = data.parray;
			long highBound, lowBound, count;
			SafeArrayGetUBound(List, 1, &highBound);
			SafeArrayGetLBound(List, 1, &lowBound);
			count = highBound - lowBound + 1;
			if (count == 1) { //only 0s element, which indicates amount of devices found
				DisplayInforMessageBox((LPCWSTR)L"Error", L"No I2C devices can be found");
				return;
			}

			BYTE HUGEP *pDevice;
			CString strDevice;
			SafeArrayAccessData(List, (void HUGEP* FAR*)&pDevice);
			for (int i = 1; i < count; i++){
				int device = pDevice[i];
				strDevice.Format(L"0x%02X",device);
				listBoxBridges->AddString(strDevice);
			}
			SafeArrayUnaccessData(List);
		}
	}
   CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
   listBoxDevices->SetCurSel(0);
   setspeed100k();  */
}
BOOL CScaleDialog::OnInitDialog()
{
  CDialog::OnInitDialog();

  CListBox* pListBox = static_cast<CListBox*>(GetDlgItem(IDC_SCALE_LIST));
  CString scaleStr;
  for(int i = 1 ; i <= 8 ; ++i)
  {
    scaleStr.Format(_T("Scale %d"), i);
    pListBox->AddString(scaleStr);
  }
  pListBox->SetCurSel(m_Scale);        // Set current scale

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
void
ArxDbgUtils::fillListBox(const SdStrObjIdList& slist, CListBox& lb, int defIndex)
{
    lb.ResetContent();
    SdStrObjIdListIterator iter(slist);

    CString str;
    AcDbObjectId objId;
    for(; !iter.done(); iter.next()){
        iter.item(str, objId);
        lb.AddString(str);
    }

    int retCode = lb.SetCurSel(defIndex);
    ASSERT(retCode != LB_ERR);
}
示例#12
0
void CDizzyDialog::OnDownButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	int iOffset = pListBox->GetCurSel();
	if ((iOffset != LB_ERR) && (iOffset != pListBox->GetCount()-1)) {
		CString strCurrent;
		pListBox->GetText(iOffset, strCurrent);
		pListBox->DeleteString(iOffset);
		iOffset++;
		pListBox->InsertString(iOffset, strCurrent);
		pListBox->SetCurSel(iOffset);
		RecalculateRotation();
	}
	UpdateData(false);
}
示例#13
0
void CChannelSelectDlg::InitChannelList( int iChannel, int iMaxChannel )
{
	CListBox				*pListBox = (CListBox *)GetDlgItem( IDC_CHANNELLIST );
	CString					str;
	int						iN;


	for( iN = 0; iN < iMaxChannel; iN ++ )
	{
		str.Format( "Channel %d", iN );
		pListBox->AddString( str );
	}

	pListBox->SetCurSel( iChannel );
	pListBox->GetText( iChannel, str );
	GetDlgItem( IDC_SELLECTEDCHANNEL )->SetWindowText( str );
}
示例#14
0
bool CFanmotorDlg::GetActiveDevice(BYTE& DeviceAddress)
{
	DeviceAddress = 255;
	CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
	listBoxDevices->SetCurSel(0);
	if (listBoxDevices->GetCurSel() < 0) {
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active DEVICE!\r\nPress \"Device List\" button and Select Device");
		return false;
	}
	CString s;
	int n = listBoxDevices->GetTextLen(listBoxDevices->GetCurSel());
	WCHAR *ch, *buf = s.GetBuffer(n);
	listBoxDevices->GetText(listBoxDevices->GetCurSel(), buf);
	DeviceAddress = (BYTE)wcstol(buf,&ch,16);
	s.ReleaseBuffer();
	return true;
}
示例#15
0
//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );
	//magic 21022011 begin
	index = pListBox->AddString( "140x140" );
	pListBox->SetItemData( index, 4 );

	index = pListBox->AddString( "160x160" );
	pListBox->SetItemData( index, 5 );
	//magic 23022011 begin
	index = pListBox->AddString( "180x180" );
	pListBox->SetItemData( index, 6 );

	index = pListBox->AddString( "200x200" );
	pListBox->SetItemData( index, 7 );
	//magic 23022011 end

	//magic 24032012 begin
	index = pListBox->AddString( "220x220" );
	pListBox->SetItemData( index, 8 );

	index = pListBox->AddString( "240x240" );
	pListBox->SetItemData( index, 9 );

	index = pListBox->AddString( "260x260" );
	pListBox->SetItemData( index, 10 );

	index = pListBox->AddString( "280x280" );
	pListBox->SetItemData( index, 11 );
	//magic 24032012 end
	//magic 21022011 end
	pListBox->SetCurSel( mapSize );
}
示例#16
0
void DLGSkill::upDate()
{
    CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillList);
    int oriSel = pLB->GetCurSel();
    pLB->ResetContent();

    char buf[256];
    for(int i = 0; CSkill::getInfoCount() > i; i++)
    {
        CSkillInfo* pInfo = CSkill::getInfo(i);
        sprintf_s(buf, sizeof(buf), "[%d] %s", i, pInfo->getName().c_str());
        CString str;
        str = buf;
        pLB->AddString(str);
    }

    pLB->SetCurSel(oriSel);
}
示例#17
0
BOOL PSWelcomePowEditor::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// Fill the list control with the names of provinces.
	CListBox* pProvLB = (CListBox*) GetDlgItem(IDC_PROV_LIST);
	int i;
	for (i = 1; i <= TG.GetNumberOfPowers(); i++)
	{
		PSPower* pPow = TG.GetPower(i);
		ASSERT(pPow);
		pProvLB->AddString(pPow->m_strName);
	}
	ASSERT(i > 1);// This box should not be displayed if there is no game loaded.

	pProvLB->SetCurSel(0);
	return TRUE;
}
示例#18
0
//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );

	pListBox->SetCurSel( mapSize );
}
示例#19
0
void CNewsHubDlg::MessageDelivered(NewsHub::ClientQueueThreadLoop* queue, const NewsHub::Socket & socket, const unsigned int messageId, const std::string & message)
{
  CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
  for (int i = 0; i < pSentMessages->GetCount(); ++i)
  {
    MessageInfo* messageInfo = (MessageInfo*)pSentMessages->GetItemDataPtr(i);
    if ((messageInfo->queue == queue) && (messageInfo->messageId == messageId))
    {
      CString str;
      pSentMessages->GetText(i, str);
      pSentMessages->DeleteString(i);
      pSentMessages->InsertString(i, str + _T(": Delivered"));
      pSentMessages->SetItemDataPtr(i, messageInfo);
      pSentMessages->SetCurSel(i);
      break;
    }
  }
}
示例#20
0
BOOL CListDlg::OnInitDialog()
{
	SetWindowText(m_strDlgTitle);
// fix this
	SetDlgItemText(IDC_STATIC_HEADING, m_strListTitle);
	CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LISTDIALOG_LIST);
	ASSERT(pListBox != NULL);
	// fill with document templates in list

	POSITION pos = m_listItems.GetHeadPosition();
	while (pos != NULL)
	{
		 if ( pListBox->AddString(m_listItems.GetNext(pos)) == -1)
			return FALSE;
	}
	pListBox->SetCurSel(m_nSelection);

	return CDialog::OnInitDialog();
}
示例#21
0
HRESULT AddDMOsToList(const GUID *clsid, CListBox& ListFilters, BOOL bIncludeKeyed) 
{
    HRESULT hr;    
    IEnumDMO *pEnum = NULL;
    int nFilters=0;
    DWORD dwFlags = bIncludeKeyed ? DMO_ENUMF_INCLUDE_KEYED : 0;

    // Enumerate all DMOs of the selected category  
    hr = DMOEnum(*clsid, dwFlags, 0, NULL, 0, NULL, &pEnum);
    if (FAILED(hr))
        return hr;

    // Enumerate all filters using the category enumerator
    hr = EnumDMOsToList(pEnum, ListFilters, nFilters);

    // Now that the DMOs (if any) are enumerated and added 
    // to the list, go ahead and select the first one.
    ListFilters.SetCurSel(0);
    pEnum->Release();
    return hr;
}
示例#22
0
void CReactorTool::InitLBTargets ()
{
    if (!GetMine ())
        return;
    CListBox *plb = LBTargets ();
    m_iTarget = plb->GetCurSel ();
    plb->ResetContent ();
    if (m_pTrigger) {
        m_nTargets = m_pTrigger->num_links;
        int i;
        for (i = 0; i < m_nTargets ; i++) {
            sprintf (m_szTarget, "   %d, %d", m_pTrigger->seg [i], m_pTrigger->side [i] + 1);
            plb->AddString (m_szTarget);
        }
        if ((m_iTarget < 0) || (m_iTarget >= m_nTargets))
            m_iTarget = 0;
        *m_szTarget = '\0';
    }
    else
        m_nTargets =
            m_iTarget = 0;
    plb->SetCurSel (m_iTarget);
}
示例#23
0
文件: 11Batch.cpp 项目: H2-T23/garage
	void	AddMessage( LPCTSTR szMsg ){
		int	idx = m_ListBox.AddString( szMsg );
		m_ListBox.SetCurSel( idx );
	}
示例#24
0
BOOL OPCServerDlg::GetOPCServers(LPTSTR node)
{
   CListBox* pList = (CListBox*)GetDlgItem( IDC_SERVER_LIST );
   USES_CONVERSION;

   CWaitCursor wait;
   ASSERT_VALID(pList);
   pList->ResetContent();

   // New 2.0 method using component categories
   IOPCServerList* pServers=NULL;

   COSERVERINFO si;
   MULTI_QI  qi;

   si.dwReserved1 = 0;
   si.pwszName = NULL;
   if( node && node[0] != 0 )
      si.pwszName = T2OLE(node);
   si.pAuthInfo = NULL;
   si.dwReserved2 = 0;

   qi.pIID = &IID_IOPCServerList;
   qi.pItf = NULL;
   qi.hr = 0;

   HRESULT hr = CoCreateInstanceEx(CLSID_OPCServerList, NULL, CLSCTX_ALL, &si, 1, &qi);
   if (FAILED(hr) || FAILED(qi.hr))
   {
      CString msg(_T("Error connecting to OPC 2.0 Server Browser."));
      if( !m_Node.IsEmpty() )
         msg.Format(_T("Error connecting to OPC 2.0 Server Browser on %s."), (LPCTSTR)m_Node);

      if( hr == REGDB_E_CLASSNOTREG )
      {
          CString msg(_T("Please install the OPC 2.0 Components."));
          if( !m_Node.IsEmpty() )
             msg.Format(_T("Please install the OPC 2.0 Components on %s."), (LPCTSTR)m_Node);
      }

      if( FAILED(hr) )
        theDoc->ReportError(msg, hr);
      else
        theDoc->ReportError(msg, qi.hr);
   }
   else
   {
       pServers = (IOPCServerList*)qi.pItf;

       IEnumGUID *pEnumGUID=NULL;
       hr = pServers->EnumClassesOfCategories(1, &m_catid, 1, &m_catid, &pEnumGUID);
       if( SUCCEEDED(hr) )
       {
          unsigned long count;
          CLSID clsid[NEXT_COUNT];

          do
          {
             hr = pEnumGUID->Next(NEXT_COUNT, clsid, &count);
             for( ULONG index=0; index<count; index++ )
             {
                LPOLESTR pszProgID;
                LPOLESTR pszUserType;
                HRESULT hr2 = pServers->GetClassDetails(clsid[index], &pszProgID, &pszUserType);
                if (SUCCEEDED(hr2))
                {
                   OPCServerInfo* pServerInfo = new OPCServerInfo(pszProgID, pszUserType, clsid[index] );
                   m_Servers.AddTail( pServerInfo );
                   CString name;
                   name.Format( _T("%s  (%s)"),
                               (LPCTSTR)pServerInfo->m_ProgID,
                               (LPCTSTR)pServerInfo->m_Description );
                   int pos = pList->AddString( name );
                   pList->SetItemData( pos, (DWORD)pServerInfo );
                   if( m_Server == pServerInfo->m_ProgID )
                      pList->SetCurSel(pos);

                   CoTaskMemFree(pszProgID);
                   CoTaskMemFree(pszUserType);
                }
             }
          }
          while ( hr==S_OK );
          pEnumGUID->Release();
          pServers->Release();
          return TRUE;
       }
       else // hr failed
       {
          CString msg(_T("EnumClassesOfCategories failed:"));
          theDoc->ReportError(msg, hr);
       }
       pServers->Release();
   }

   // Old 1.0 method: search the registry for OPC entries
   if( m_catid != CATID_OPCDAServer10 )
       return FALSE;

   HKEY hk = HKEY_CLASSES_ROOT;
   if( node )
   {
      DWORD dwR = RegConnectRegistry ((LPTSTR)node, HKEY_CLASSES_ROOT, &hk);
      if( dwR != ERROR_SUCCESS )
         return FALSE;
   }

   TCHAR key[MAX_KEYLEN];
   DWORD size = MAX_KEYLEN;
   FILETIME ft;
   for( int index=0; RegEnumKeyEx(hk, index, key, &size, 0, NULL, NULL, &ft)==ERROR_SUCCESS; index++)
   {
      HKEY hProgID=0;
      if(RegOpenKeyEx(hk, key, 0, KEY_QUERY_VALUE, &hProgID )==ERROR_SUCCESS )
      {
         // Find OPC key
         HKEY hOPC=0;
         if(RegOpenKeyEx(hProgID, _T("OPC"), 0, KEY_QUERY_VALUE, &hOPC)==ERROR_SUCCESS )
         {
            // Found OPC key, save this information
            CLSID clsid;
            DWORD type=REG_SZ;
            HKEY hCLSID=0;
            if(RegOpenKeyEx(hProgID, _T("CLSID"), 0, KEY_QUERY_VALUE, &hCLSID)==ERROR_SUCCESS )
            {
                TCHAR clsidString[MAX_KEYLEN];
                size=MAX_KEYLEN;
                if(RegQueryValueEx(hCLSID, key, 0, &type, (BYTE*)clsidString, &size )==ERROR_SUCCESS )
                {
                    hr = CLSIDFromString( T2OLE(clsidString), &clsid );
                    if( FAILED(hr))
                    {
                    theDoc->ReportError( _T("CLSIDFromString: "), hr );
                    continue;
                    }
                }
            }
            
            TCHAR desc[MAX_KEYLEN];
            size=MAX_KEYLEN;
            RegQueryValueEx(hOPC, key, 0, &type, (BYTE*)desc, &size);
            OPCServerInfo* pServerInfo = new OPCServerInfo(T2OLE(key), L"", clsid );
            m_Servers.AddTail( pServerInfo );
            int pos = pList->AddString( pServerInfo->m_ProgID );
            pList->SetItemData( pos, (DWORD)pServerInfo );
            if( m_Server == key )
               pList->SetCurSel(pos);
            RegCloseKey( hOPC );
         }
         RegCloseKey( hProgID );
      }
      size = MAX_KEYLEN;
   }

   OnSelchangeServerList();

   return TRUE;
}
示例#25
0
void CIWinSyncDlg::PopulateSettingsDialog()
{
	//Set the Current Sync Path
	CEdit* pPathEditBox = NULL;
	pPathEditBox = (CEdit*) GetDlgItem(IDC_EDIT_PATH);
	if (pPathEditBox != NULL)
	{
		pPathEditBox->SetWindowTextW(m_pszCurrentSyncPath);
	}
	pPathEditBox = NULL;

	//Set the Current Sync Interval
	CEdit* pIntervalEditBox = NULL;
	pIntervalEditBox = (CEdit*) GetDlgItem(IDC_EDIT_INTERVAL);
	if (pIntervalEditBox != NULL)
	{
		TCHAR szSyncInterval[50];
		_stprintf_s(szSyncInterval,50,_T("%u"),(m_nSyncInterval/60000));
		pIntervalEditBox->SetWindowTextW(szSyncInterval);
	}
	pIntervalEditBox = NULL;


	//Set the Suppress Dialogs Check box
	CButton* pEnableDialogsBtn = (CButton*) GetDlgItem(IDC_CHECK_SUPPRESS);
	if (pEnableDialogsBtn != NULL)
	{
		pEnableDialogsBtn->SetCheck(m_bSuppressDialogs);
	}
	pEnableDialogsBtn = NULL;

	//Set the Disable Sync Check box
	CButton* pDisableSyncBtn = (CButton*) GetDlgItem(IDC_CHECK_DISABLE);
	if (pDisableSyncBtn != NULL)
	{
		pDisableSyncBtn->SetCheck(m_bDisableSync);
	}
	pEnableDialogsBtn = NULL;

	//Set The Last Result Strings
	for (int i=0;i<5;i++)
	{
		CStatic *pResultText = NULL;
		switch(i)
		{
		case 0:
			pResultText = (CStatic*) GetDlgItem(IDC_RESULT1);
			break;
		case 1:
			pResultText = (CStatic*) GetDlgItem(IDC_RESULT2);
			break;
		case 2:
			pResultText = (CStatic*) GetDlgItem(IDC_RESULT3);
			break;
		case 3:
			pResultText = (CStatic*) GetDlgItem(IDC_RESULT4);
			break;
		case 4:
			pResultText = (CStatic*) GetDlgItem(IDC_RESULT5);
			break;
		}
		if (pResultText != NULL)
		{
			if (m_apszLastResults[i] != NULL)
			{
				pResultText->SetWindowTextW(m_apszLastResults[i]);
			}
			else
			{
				pResultText->SetWindowTextW(_T(""));
			}
		}
		pResultText = NULL;
	}

	//Select The Current Logging Level
	CListBox * pLoggingLevelList = (CListBox*) GetDlgItem(IDC_LIST_LOGLEVEL);
	if (pLoggingLevelList != NULL)
	{
		
		if (m_dwLogLevel < 0 || m_dwLogLevel > 2)
		{
			m_dwLogLevel = DEFAULT_LOG_LEVEL;
		}
		pLoggingLevelList->SetCurSel(m_dwLogLevel);
	}
	pLoggingLevelList = NULL;
	UpdateData(FALSE);
}
示例#26
0
// runChecker:
// Run the spelling checker and display the next misspelled word.
void CSpellingDlg::runChecker() {
	SSCE_CHAR word[SSCE_MAX_WORD_SZ];
	SSCE_CHAR otherWord[SSCE_MAX_WORD_SZ];

	CWaitCursor busy;
    
    // Process auto-corrections
	SSCE_S16 result;
    do {
        result = SSCE_CheckString(SSCE_GetSid(), text, &cursor, word, sizeof(word),
		  otherWord, sizeof(otherWord));
        if (result == SSCE_AUTO_CHANGE_WORD_RSLT) {
            // Replace the word in the text block
            if (SSCE_ReplaceStringWord(SSCE_GetSid(), text, textSz, cursor,
			  otherWord) >= 0) {
                // Replace the word in the edit control.
				editCtrl->SetSel(cursor, cursor + lstrlen((TCHAR *)word));
				editCtrl->ReplaceSel((TCHAR *)otherWord);
            }

            // Skip over the replaced word to avoid problems caused by
            // recursive replacements
			cursor += lstrlen((TCHAR *)otherWord);
        }
    } while (result == SSCE_AUTO_CHANGE_WORD_RSLT);
    
    if (result == SSCE_END_OF_BLOCK_RSLT) {
        // End of text reached.
        EndDialog(IDOK);
	}
    else {
		CString problemDesc;

        // A problem was detected.
        if (result == (SSCE_MISSPELLED_WORD_RSLT | SSCE_UNCAPPED_WORD_RSLT)) {
            problemDesc = _T("Capitalization:");
		}
        else if (result & SSCE_MISSPELLED_WORD_RSLT) {
            problemDesc = _T("Not in dictionary:");
		}
        else if (result == SSCE_CONDITIONALLY_CHANGE_WORD_RSLT) {
            problemDesc = _T("Consider changing:");
		}
        else if (result == SSCE_DOUBLED_WORD_RSLT) {
            problemDesc = _T("Doubled word:");
        }
		SetDlgItemText(IDC_PROBLEMDESC, problemDesc);
		SetDlgItemText(IDC_PROBLEMWORD, (TCHAR *)word);

		CListBox *suggestionsList = (CListBox *)GetDlgItem(IDC_SUGGESTIONSLIST);
        if (result & SSCE_MISSPELLED_WORD_RSLT) {
            // Fill the suggestions list with suggestions.
            suggestionDepth = SSCE_GetMinSuggestDepth();
            fillSuggestionsList();
		}
        else if (result == SSCE_CONDITIONALLY_CHANGE_WORD_RSLT) {
            // Add the replacement word to the suggestions list.
			suggestionsList->ResetContent();
            suggestionsList->AddString((TCHAR *)otherWord);
            suggestionsList->SetCurSel(0);
		}
        else if (result == SSCE_DOUBLED_WORD_RSLT) {
            // Clear the suggestions list.
            suggestionsList->ResetContent();
			SetDlgItemText(IDC_CHANGETO, _T(""));
        }
        
        // Highlight the problem word in the edit control.
		editCtrl->SetSel(cursor, cursor + lstrlen((TCHAR *)word));
    }
}