BOOL CImp_DrawDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog box. SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // // Display the Logon dialog box. // CString csDefaultQueueName = GetUserName(); m_csLogin = LoginPrompt(csDefaultQueueName); while (m_csLogin == "") { m_csLogin = LoginPrompt(csDefaultQueueName); } SetWindowText(m_csLogin); // // First, we have to initialize COM. // if (!AfxOleInit()) { MessageBox("Failed to initialize COM."); exit(1); } // // Establish whether the local computer is enabled to access the directory // service (DS) and set the UI accordingly. // m_fDsEnabledLocaly = IsDsEnabledLocaly(); if(!m_fDsEnabledLocaly) { // // The computer is DS-disabled. This is the right place to open the receiving queue // because it is a local private queue. This operation is not time-consuming. // // // Open the receiving queue and receive incoming messages. // if (!OpenPrivateReceiveQueue()) { // // The attempt to open the receiving queue failed. // MessageBox("The receiving queue cannot be opened."); } } initializeUI(m_fDsEnabledLocaly); return TRUE; // Return TRUE unless you set the focus to a control. }
BOOL CDisdrawDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog box. The framework does this automatically // when the application's main window is not a dialog box. SetIcon(m_hIcon, TRUE); // Use the large icon. SetIcon(m_hIcon, FALSE); // Use the small icon. // // Display the logon name in the title bar. // SetWindowText(m_strLogin); // // No queues are open yet. // m_hqIncoming = NULL; m_hqOutgoing = NULL; // // Establish connection mode. // m_fDsEnabledLocaly = IsDsEnabledLocaly(); if (!m_fDsEnabledLocaly) { // // The computer is DS-disabled. This is the right place to open the receiving queue // because it is a local private queue. This operation is not time-consuming. // // // Open the receiving queue and receive incoming messages. // if (OpenPrivateReceiveQueue()) { startReceiveUpdateThread(); } else { // // The receiving queue could not be opened. // MessageBox("The receiving queue cannot be opened."); } } initializeUi(m_fDsEnabledLocaly); return TRUE; // Return TRUE unless you set the focus to a control. }