Exemplo n.º 1
0
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.
}
Exemplo n.º 2
0
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.
}
Exemplo n.º 3
0
void CImp_DrawDlg::OnConnect() 
{
    //
    // See what the user selected.
    //
    UpdateData(TRUE);
    if(m_iRadioDS == 0)
    {
        //
        // Access to the DS is enabled, and the user chose to connect in domain (standard) mode.
        //
        //
	    // Open the receiving queue and receive incoming messages.
	    //
        CWaitCursor wait;
        if (!OpenReceiveQueue())
        {
            //
            // The attempt to open the receiving queue failed.
            //
            MessageBox("The receiving queue cannot be opened.");

        }
	  
        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        // -> Show relevant controls.
        //
        
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);
        
    }
    else//m_iRadio == 1
    {
        //
        // Access to the DS is enabled, and the user chose to connect in workgroup (direct) mode.  
        //
        //
	    // Open the receiving queue and receive incoming messages.
	    //
        CWaitCursor wait ;
        if (!OpenPrivateReceiveQueue())
        {
            //
            // The attempt to open the receiving queue failed.
            //
            MessageBox("The receiving queue cannot be opened.");

        }
	  
        //
        // ->Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);
        
        //
        //-> Show relevant controls.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }	
}
Exemplo n.º 4
0
void CDisdrawDlg::OnConnect() 
{
    //
    // See what the user selected.
    //
    UpdateData(TRUE);
    if(m_iRadioDS == 0)
    {
        //
        // The DS is enabled locally, and the user chose to connect in standard mode.
        //
        
         CWaitCursor wait ;

        //
	    // Open the receiving queue and receive incoming messages.
	    //
        
        if (OpenReceiveQueue())
        {
            startReceiveUpdateThread();                         
        }
	    else
        {
		    AfxMessageBox("The receiving queue cannot be opened.");
        }


        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        // Show relevant controls.
        //
        
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);
        
    }
    else//m_iRadio == 1
    {
        //
        // The DS is enabled locally, and the user chose to connect in direct mode.
        //
        //
        // The constructor changes the cursor to an hourglass.
        // When the object goes out of scope, the cursor changes back to normal.
        //
        CWaitCursor wait ;

        //
	    // Open the receiving private queue and receive incoming messages.
	    //
        
        if (OpenPrivateReceiveQueue())
        {
            startReceiveUpdateThread();
        }
	    else
        {
		    AfxMessageBox("The receiving queue cannot be opened.");
        }


        
        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);
        
        //
        // Show relevant controls.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }

	
}