//////////////////////////////////////////////////////////////////// // BOOL CProgress::SetText // //////////////////////////////////////////////////////////////////// BOOL CProgress::SetText(WCHAR* pwszText) { ASSERT(pwszText); wSetDlgItemText(m_hWnd, IDT_STAT_INFO, pwszText); return TRUE; }
//////////////////////////////////////////////////////////////////// // BOOL CProgress::SetHeading // //////////////////////////////////////////////////////////////////// BOOL CProgress::SetHeading(WCHAR* pwszText) { ASSERT(pwszText); wSetDlgItemText(m_hWnd, IDT_STATUS, pwszText); return TRUE; }
///////////////////////////////////////////////////////////////////////////// // BOOL CS3Dialog::RefreshControls // ///////////////////////////////////////////////////////////////////////////// BOOL CS3Dialog::RefreshControls() { BOOL fConnected; CTable* pCToTable = m_pCTableCopy->m_pCToTable; CTable* pCFromTable = m_pCTableCopy->m_pCFromTable; CDataSource* pCDataSource = pCToTable->m_pCDataSource; // Must have a connection to edit other controls fConnected = pCToTable->IsConnected(); //Enable certain dialog controls, only if connected EnableWindow(GetDlgItem(m_hWnd, IDE_TO_TABLE), fConnected); EnableWindow(GetDlgItem(m_hWnd, IDT_TARGET), fConnected); EnableWindow(GetDlgItem(m_hWnd, IDT_TOTABLEHELP), fConnected); //Store the selected ProviderName and ProviderDesc LRESULT iSel = 0; if((iSel = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR) { //Since we have the CBS_SORT turned on, the order in the Combo Box does //not match our array, so we pass the array index (lParam) as the item data LRESULT lParam = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L); ASSERT(lParam < (LONG)pCDataSource->m_cProviderInfo); pCDataSource->m_pwszProviderName = pCDataSource->m_rgProviderInfo[lParam].wszName; pCDataSource->m_pwszProviderParseName = pCDataSource->m_rgProviderInfo[lParam].wszParseName; } // Show user the connection string, and enable Next that requires connection if(fConnected) { //CONNECTSTATUS SetDlgItemText(m_hWnd, IDT_CONNECTSTATUS, ""); //CONNECT_STRING wSetDlgItemText(m_hWnd, IDT_TO_CONNECT, wsz_CONNECT_STRING_, pCDataSource->m_pwszProviderName, pCDataSource->m_pwszDataSource, pCDataSource->m_pwszDBMS, pCDataSource->m_pwszDBMSVer, pCDataSource->m_pwszProviderFileName, pCDataSource->m_pwszProviderVer); //TABLEHELPMSG wSetDlgItemText(m_hWnd, IDT_TOTABLEHELP, wsz_TOTABLEHELP_, pCDataSource->m_pwszTableTerm); } else { //CONNECTSTATUS wSetDlgItemText(m_hWnd, IDT_CONNECTSTATUS, wsz_NOT_CONNECTED); //CONNECT_STRING wSetDlgItemText(m_hWnd, IDT_TO_CONNECT, L""); } // If there is already a Table from previous selections, just use that one wSetDlgItemText(m_hWnd, IDE_TO_TABLE, pCToTable->m_TableInfo.wszTableName[0] ? pCToTable->m_TableInfo.wszTableName : pCFromTable->m_TableInfo.wszTableName); // Determine if there is enough information to move on return EnableTable(); }
///////////////////////////////////////////////////////////////////////////// // BOOL CS3Dialog::InitControls // ///////////////////////////////////////////////////////////////////////////// BOOL CS3Dialog::InitControls() { //Initialize the Provider List (if not done so already) CDataSource* pCDataSource = m_pCTableCopy->m_pCToTable->m_pCDataSource; CDataSource* pCFromDataSource = m_pCTableCopy->m_pCFromTable->m_pCDataSource; if(pCDataSource->m_rgProviderInfo == NULL) pCDataSource->GetProviders(); WCHAR wszBuffer[MAX_NAME_LEN*2]; HWND hWndProv = GetDlgItem(m_hWnd, IDC_PROVIDER_NAME); //Fill out the provider name combo box. for(ULONG i=0; i<pCDataSource->m_cProviderInfo; i++) { //Add the name to the list //Since we have the CBS_SORT turned on, the order in the Combo Box does //not match our array, so we pass the array index (lParam) as the item data StringCchPrintfW(wszBuffer, sizeof(wszBuffer)/sizeof(WCHAR), wsz_PROVIDER_INFO_, pCDataSource->m_rgProviderInfo[i].wszName); LRESULT iIndex = wSendMessage(hWndProv, CB_ADDSTRING, (WPARAM)0, wszBuffer); SendMessage(hWndProv, CB_SETITEMDATA, (WPARAM)iIndex, (LPARAM)i); } //By default, it selects the same provider chossen in Step1 if(pCDataSource->m_pwszProviderName == NULL) pCDataSource->m_pwszProviderName = pCFromDataSource->m_pwszProviderName; //Try and select the previous selected Provider if(CB_ERR == wSendMessage(hWndProv, CB_SELECTSTRING, 0, pCDataSource->m_pwszProviderName)) { //If not found, just select the first one SendMessage(hWndProv, CB_SETCURSEL, 0, 0); } //By default, try and Connect to the same DataSource as in Step1 //if using the same provider as in Step1 if(!m_pCTableCopy->m_pCToTable->IsConnected() && wcscmp(pCDataSource->m_pwszProviderName, pCFromDataSource->m_pwszProviderName)==0) { //The Provider must support more than 1 active session as well to do //this functionality by default... if(pCFromDataSource->m_ulActiveSessions==0 || pCFromDataSource->m_ulActiveSessions>=2) Connect(pCFromDataSource); } // Enable Connect button only if there are providers installed. EnableWindow(GetDlgItem(m_hWnd, IDB_FROM_CONNECT), SendMessage(hWndProv, CB_GETCURSEL, 0, 0L) != CB_ERR); // Set the "Source" info //CONNECT_STRING wSetDlgItemText(m_hWnd, IDT_FROM_CONNECT, wsz_CONNECT_STRING_, pCFromDataSource->m_pwszProviderName, pCFromDataSource->m_pwszDataSource, pCFromDataSource->m_pwszDBMS, pCFromDataSource->m_pwszDBMSVer, pCFromDataSource->m_pwszProviderFileName, pCFromDataSource->m_pwszProviderVer); //TABLE wSetDlgItemText(m_hWnd, IDE_FROM_TABLE, m_pCTableCopy->m_pCFromTable->m_wszQualTableName); return TRUE; }