Beispiel #1
0
static void LoadIniStream(Stream& in, VectorMap<String, String>& key, const char *sfile)
{
	bool env = false;
	while(!in.IsEof()) {
		String line = in.GetLine();
		CParser p(line);
		if(p.IsId()) {
			String k = p.ReadId();
			if(p.Char('=')) {
				String h = TrimBoth((String)p.GetSpacePtr());
				if(env) {
					String hh;
					const char *s = ~h;
					while(*s) {
						if(*s == '$') {
							s++;
							if(*s == '$') {
								hh.Cat('$');
								s++;
							}
							else {
								String id;
								if (*s == '{') {
									while(*++s != '}')
										id.Cat(*s);
									s++;
								} else {
									while(iscid(*s))
										id.Cat(*s++);
								}
								hh.Cat(GetEnv(id));
							}
						}
						else
							hh.Cat(*s++);
					}
					key.Add(k, hh);
				}
				else
					key.Add(k, h);
			}
		}
		else
		if(p.Char('@')) {
			if(p.Id("include")) {
				String fn = p.GetPtr();
				if(!IsFullPath(fn) && sfile)
					fn = AppendFileName(GetFileFolder(GetFullPath(sfile)), fn);
				LoadIniFile(fn, key);
			}
			else
			if(p.Id("end"))
				return;
			else
			if(p.Id("replace-env"))
				env = true;
			else
			if(p.Id("ignore-env"))
				env = false;
		}
	}
}
Beispiel #2
0
VectorMap<String, String> LoadIniFile(const char *filename)
{
    VectorMap<String, String> ret;
    LoadIniFile(filename, ret);
    return ret;
}
BOOL CBaseDialog::OnInitDialog()
{
    //SetTextBkColor(RGB(238,241,243));
    CDialog::OnInitDialog();

    // Add "About..." menu item to system menu.

    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
	//del MAX
	if (pSysMenu != NULL)
	{
		pSysMenu->DeleteMenu(SC_MAXIMIZE, MF_BYCOMMAND);//add by liub for 标题栏右键菜单删除最大化
	}

    if (m_bstatus)
    {
        if (pSysMenu != NULL)
        {
            CString strAboutMenu;
			CString temp;
            temp.LoadString(IDS_ABOUTBOX);
			strAboutMenu.Format(temp, g_SetData.Main_szPrefixName);
            if (!strAboutMenu.IsEmpty())
            {
                pSysMenu->AppendMenu(MF_SEPARATOR);
                pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
            }
        }
		//help  
        CString strHelpMenu;
        strHelpMenu.LoadString(IDS_HELPDOC);
        if (!strHelpMenu.IsEmpty())
        {
			 if(g_SetData.Main_nHelp)	
				pSysMenu->AppendMenu(MF_STRING, IDS_HELPDOC, strHelpMenu);
        }

    }

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);            // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon
    
    // TODO: Add extra initialization here
    LoadIniFile();
    m_hIconInfo = (HICON)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDI_ICON_INFO), RT_GROUP_ICON), MAKEINTRESOURCE(IDI_ICON_INFO), IMAGE_ICON, 0, 0, 0);

	if(m_nBkTag == 0) 
	{
		if(m_bWinSize)
		{
			m_bmpBackground.LoadBitmap(/*IDB_BACK_MAIN*/IDB_BACK_CON);
		}
		else
		{
			m_bmpBackground.LoadBitmap(IDB_BACK_MAIN_DEFAULT);
		}
	}
	else if(m_nBkTag == 1)
	{
		m_bmpBackground.LoadBitmap(IDB_BACK_PAGE1);
	}
	else if(m_nBkTag == 2)
	{
		if(m_bWinSize)
		{
			m_bmpBackground.LoadBitmap(IDB_BACK_CON);
		}
		else
		{
			m_bmpBackground.LoadBitmap(IDB_BACK_CON_DEFAULT);
		}
		
		CPaintDC dc(this);
        CDC dcMem; 
        dcMem.CreateCompatibleDC(&dc); 
        BITMAP bitMap;
        m_bmpBackground.GetBitmap(&bitMap);
        CBitmap *pbmpOld=dcMem.SelectObject(&m_bmpBackground);

		CDC dctemp;
		dctemp.CreateCompatibleDC(&dcMem);
		CBitmap *m_pbmpTemp;
//*		
		HBITMAP m_hBitmap;        // Handle of the bitmap
		// Load the image
		m_hBitmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),
			g_SetData.Main_szLogoBmp, IMAGE_BITMAP, 0, 0,
			LR_LOADFROMFILE|LR_CREATEDIBSECTION|LR_DEFAULTSIZE);

		m_pbmpTemp=CBitmap::FromHandle(m_hBitmap);
//*/
//		m_bmpTemp.LoadBitmap(IDB_LOGO);
		CBitmap *pbmpOld1=dctemp.SelectObject(m_pbmpTemp);

		#ifdef FEATURE_UICOLOR_GREY		
			dcMem.BitBlt(g_TabDlgRect.Width() - 130,2,bitMap.bmWidth,bitMap.bmHeight,
					&dctemp,0,0,SRCCOPY);
		#else
			dcMem.BitBlt(g_TabDlgRect.Width() - 130,1,bitMap.bmWidth,bitMap.bmHeight,&dctemp,0,0,SRCCOPY);
			//dcMem.BitBlt(g_TabDlgRect.Width() - 130,1,bitMap.bmWidth,bitMap.bmHeight,&dctemp,0,0,SRCCOPY);
		#endif
	}
    //m_bmpBackground.LoadBitmap(IDB_BACK_MAIN+m_nBkTag);
    //m_bmpBackground.LoadBitmap(IDB_BACK_MAIN);
        
 //   m_Tip.Create(this);
    
    if (m_blUseFlashEffect){
        InitDlgWithFlashEffect(); //渐变效果
    }else{
        ActionAfterInitDlgWithFlashEffect();
    }
    
    
    return TRUE;  // return TRUE  unless you set the focus to a control
}