void CSecondPage::InitBrowseList() { CPrinterSetupWizardSheet * psheet; CString text; psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_quiet( psheet, exit ); // // load the no rendezvous printers message until something shows up in the browse list // text.LoadString(IDS_NO_RENDEZVOUS_PRINTERS); LoadTextAndDisableWindow( text ); // // disable the next button until there's a printer to select // psheet->SetWizardButtons(PSWIZB_BACK); // // disable the printer information box // SetPrinterInformationState( FALSE ); exit: return; }
void CSecondPage::OnResolveService( Service * service ) { CPrinterSetupWizardSheet * psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_quiet( psheet, exit ); check( service ); if ( !--service->printer->resolving ) { // // sort the services now. we want the service that // has the highest priority queue to be first in // the list. // service->printer->services.sort( OrderServiceFunc ); // // and set it to selected // m_selected = service->printer; m_selectedName = service->printer->name; // // and update the printer information box // SetPrinterInformationState( TRUE ); m_descriptionField.SetWindowText( service->description ); m_locationField.SetWindowText( service->location ); psheet->SetWizardButtons( PSWIZB_BACK|PSWIZB_NEXT ); // // reset the cursor // psheet->m_active = psheet->m_arrow; SetCursor(psheet->m_active); } exit: return; }
void CSecondPage::OnTvnSelchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); CPrinterSetupWizardSheet * psheet; int err = 0; HTREEITEM item = m_browseList.GetSelectedItem(); require_quiet( item, exit ); psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_action( psheet, exit, err = kUnknownErr ); Printer * printer; printer = reinterpret_cast<Printer*>(m_browseList.GetItemData( item ) ); require_quiet( printer, exit ); // // this call will trigger a resolve. When the resolve is complete, // our OnResolve will be called. // err = StartResolve( printer ); require_noerr( err, exit ); // // And clear out the printer information box // SetPrinterInformationState( FALSE ); m_descriptionField.SetWindowText(L""); m_locationField.SetWindowText(L""); exit: if (err != 0) { CString text; CString caption; text.LoadString(IDS_ERROR_SELECTING_PRINTER_TEXT); caption.LoadString(IDS_ERROR_SELECTING_PRINTER_CAPTION); MessageBox(text, caption, MB_OK|MB_ICONEXCLAMATION); } *pResult = 0; }
void CSecondPage::InitBrowseList() { CPrinterSetupWizardSheet * psheet; CString text; psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_quiet( psheet, exit ); // Initialize so that nothing is selected when we add to the list psheet->SetSelectedPrinter( NULL ); m_gotChoice = false; m_browseList.Select( NULL, TVGN_FIRSTVISIBLE ); // // load the no printers message until something shows up in the browse list // text.LoadString(IDS_NO_PRINTERS); LoadTextAndDisableWindow( text ); // // disable the next button until there's a printer to select // psheet->SetWizardButtons(PSWIZB_BACK); // // disable the printer information box // SetPrinterInformationState( FALSE ); m_descriptionField.SetWindowText( L"" ); m_locationField.SetWindowText( L"" ); exit: return; }
void CSecondPage::OnResolveService( Service * service ) { CPrinterSetupWizardSheet * psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_quiet( psheet, exit ); check( service ); Queue * q = service->SelectedQueue(); check( q ); // // and set it to selected // m_selectedName = service->printer->name; // // and update the printer information box // SetPrinterInformationState( TRUE ); m_descriptionField.SetWindowText( q->description ); m_locationField.SetWindowText( q->location ); // // reset the cursor // SetCursor(psheet->m_active); exit: return; }
void CSecondPage::OnTvnSelchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); CPrinterSetupWizardSheet * psheet; Printer * printer; int err = 0; psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent()); require_action( psheet, exit, err = kUnknownErr ); // The strange code here is to workaround a bug in the CTreeCtrl, whereupon the item // we selected isn't passed through correctly to this callback routine. if ( !m_gotChoice ) { printer = psheet->GetSelectedPrinter(); // If we really haven't selected a printer, then re-select NULL and exit if ( !printer ) { m_browseList.SelectItem( NULL ); goto exit; } // If we already have selected a printer, fake like we've clicked on it, but only // if the CTreeCtrl hasn't already selected it else if ( printer->item != m_browseList.GetSelectedItem() ) { m_gotChoice = true; m_browseList.SelectItem( printer->item ); goto exit; } } HTREEITEM item = m_browseList.GetSelectedItem(); require_quiet( item, exit ); printer = reinterpret_cast<Printer*>(m_browseList.GetItemData( item ) ); require_quiet( printer, exit ); // // this call will trigger a resolve. When the resolve is complete, // our OnResolve will be called. // err = psheet->StartResolve( printer ); require_noerr( err, exit ); // // And clear out the printer information box // SetPrinterInformationState( FALSE ); m_descriptionField.SetWindowText(L""); m_locationField.SetWindowText(L""); exit: if (err != 0) { CString text; CString caption; text.LoadString(IDS_ERROR_SELECTING_PRINTER_TEXT); caption.LoadString(IDS_ERROR_SELECTING_PRINTER_CAPTION); MessageBox(text, caption, MB_OK|MB_ICONEXCLAMATION); } *pResult = 0; }