Ejemplo n.º 1
0
/*******************************************************************************
 Function Name    : OnInitDialog
 Input(s)         :     -
 Output           :     -
 Functionality    : This will populate the first list box with unsupported
                    keys and environment handlers and the second list box
                    with available keys.
 Member of        :     -
 Friend of        :     -
 Author(s)        : Amit Ranjan
 Date Created     : 22.04.2004
 Modifications    :
*******************************************************************************/
BOOL CEnvVarHandlerDlg::OnInitDialog()
{
    try
    {
        int Flag = 0;
        int m = 0;

        char allkey[]= {'a','b','c','d','e','f','g','h','i','j','k','l','m','n',
                        'o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E',
                        'F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V',
                        'W','X','Y','Z','0','1','2','3','4','5','6','7','8','9',0
                       };
        CDialog::OnInitDialog();

        for(m = 0; m < ouUnSptdKey.nGetSize(); m++)
        {
            m_UnSupKeys.AddString( ouUnSptdKey.omGetAt(m) );
        }

        for( m = 0; m < defINT_SizeofacAltKeyArray ; m++ )
        {
            Flag = 0;
            for( int p = 0; p <= cIndex2-1; p++)
            {
                if(allkey[m] == acSptdKey[p])
                {
                    Flag = 1;
                    break;
                }
            }
            if( Flag == 0)
            {
                m_AltKeys.AddString( CString( allkey[m] ) );
            }
        }

        m_UnSupKeys.SetCurSel(0);
        m_AltKeys.SetCurSel(0);

        if( m_AltKeys.GetCount() == 0)
        {
            //if no key is available
            GetDlgItem( IDC_CBTN_ADD )->EnableWindow(FALSE);
            ShowWindow(SW_SHOW);
            MessageBox("No Key is avilable",NULL,MB_OK);

        }
    }

    catch(...)
    {
        CString cs;

        cs.Format(ExceptionFormat,"\"OnInitDialog\"",__FILE__,__LINE__);
        MessageBox(cs);
        exit(0);
    }

    return TRUE;

}