Пример #1
0
// sélection de la langue
void LANG_INIT() {
  CWinApp* pApp = AfxGetApp();
  if (pApp) {
    int test = pApp->GetProfileInt("Language","IntId",0);
    LANG_T(pApp->GetProfileInt("Language","IntId",0));
  }
}
Пример #2
0
//----------------------------- FUNCTION -------------------------------------*
void
    CWindowPlacement::GetProfileWP(LPCTSTR pszKeyName)
/*>>>> 
Get window placement from profile.

Result
  void
<<<<*/
{
    CWinApp *pApp = AfxGetApp();
    ASSERT_VALID(pApp);

    showCmd = pApp->GetProfileInt(pszKeyName, WP_SHOW_CMD, showCmd);
    flags   = pApp->GetProfileInt(pszKeyName, WP_FLAGS, flags);

    ptMinPosition.x = pApp->GetProfileInt(pszKeyName, WP_MIN_POS_X, 
                                          ptMinPosition.x);
    ptMinPosition.y = pApp->GetProfileInt(pszKeyName, WP_MIN_POS_Y,
                                          ptMinPosition.y);
    ptMaxPosition.x = pApp->GetProfileInt(pszKeyName, WP_MAX_POS_X, 
                                          ptMaxPosition.x);
    ptMaxPosition.y = pApp->GetProfileInt(pszKeyName, WP_MAX_POS_Y,
                                          ptMaxPosition.y);

    RECT& rc  = rcNormalPosition;
    rc.left   = pApp->GetProfileInt(pszKeyName, WP_LEFT,   rc.left);
    rc.right  = pApp->GetProfileInt(pszKeyName, WP_RIGHT,  rc.right);
    rc.top    = pApp->GetProfileInt(pszKeyName, WP_TOP,    rc.top);
    rc.bottom = pApp->GetProfileInt(pszKeyName, WP_BOTTOM, rc.bottom);
}
Пример #3
0
BOOL CLogin::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	CWinApp* pApp = AfxGetApp();

	//determine range of accounts in history.
	//range begins at 1 and ends at and includes latest.  Bing: "latest" is actually the count for previous logins.
	//
	//in this case, if 0 is the latest, then there is no history
	//and thus, don't do anything.

	UINT latest = pApp->GetProfileInt("History", "Latest", 0);

	m_ListBox.SetExtendedStyle( m_ListBox.GetExtendedStyle() | LVS_EX_FULLROWSELECT );
	m_ListBox.InsertColumn(0, "Name", LVCFMT_LEFT, 75);
	m_ListBox.InsertColumn(1, "Zone", LVCFMT_LEFT, 75);
	m_ListBox.InsertColumn(2, "Server Host", LVCFMT_LEFT, 110);
	m_ListBox.InsertColumn(3, "Port", LVCFMT_LEFT, 75);

	for(UINT i = 1; i <= latest; i++)
	{
		FillBoxes(i, true);
	}

	int count = m_ListBox.GetItemCount();

	if(count > 0)
	{
		VERIFY(m_ListBox.SetItemState(count-1, 0xFFFFFFFF, LVIS_SELECTED));
	}

	// set the last login
	int last_login = pApp->GetProfileInt("History", "LastLogin", 0);
	if(last_login == 0) /* no last login */
	{
		if(latest > 0)
		{
			last_login = latest;
		}
	}
	if(last_login > 0)
	{
		FillBoxes(last_login, false);
	}

	CButton *cbox = (CButton *)GetDlgItem(IDC_CHECK_PRELOGINS);
	if(pApp->GetProfileInt("ShowPreviousLogins", "YesNo", 1) == 0)
	{
		cbox->SetCheck(BST_UNCHECKED);
	}
	else
	{
		cbox->SetCheck(BST_CHECKED);
	}
	OnBnClickedCheckPrelogins();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #4
0
CRunMap::CRunMap(CWnd* pParent /*=NULL*/)
	: CDialog(CRunMap::IDD, pParent)
{
	m_bSwitchMode = FALSE;

	//{{AFX_DATA_INIT(CRunMap)
	m_iVis = -1;
	m_bNoQuake = FALSE;
	m_strQuakeParms = _T("");
	m_bSaveVisiblesOnly = FALSE;
	m_iLight = -1;
	m_iCSG = -1;
	m_iQBSP = -1;
	//}}AFX_DATA_INIT

	// read from ini
	CWinApp *App = AfxGetApp();
	m_iCSG = App->GetProfileInt(pszSection, "CSG", 0);
	m_iQBSP = App->GetProfileInt(pszSection, "QBSP", 0);

	// The onlyents option was moved to the CSG setting, so don't allow it for BSP.
	if (m_iQBSP > 1)
	{
		m_iQBSP = 1;
	}

	m_iVis = App->GetProfileInt(pszSection, "Vis", 0);
	m_iLight = App->GetProfileInt(pszSection, "Light", 0);
	m_bNoQuake = App->GetProfileInt(pszSection, "No Game", 0);
	m_strQuakeParms = App->GetProfileString(pszSection, "Game Parms", "");
}
Пример #5
0
void CChatViewerFont::init()
{
	CWinApp* app = AfxGetApp();
	name         = app->GetProfileString( "Style\\Font", "name", name.c_str() );
	size         = app->GetProfileInt( "Style\\Font", "size", size );
	codepage     = app->GetProfileInt( "Style\\Font", "codepage", codepage );
	characterSet = app->GetProfileInt( "Style\\Font", "characterSet", characterSet );
}
Пример #6
0
void CPadView::Initialize()
{
	CWinApp* pApp = AfxGetApp();
	m_bDefWordWrap = pApp->GetProfileInt(szSettings, szWordWrap, 0);
	m_bDefWordWrapOld = m_bDefWordWrap;
	m_nDefTabStops = pApp->GetProfileInt(szSettings, szTabStops, 8*4);
	m_nDefTabStopsOld = m_nDefTabStops;
	GetProfileFont(szFont, &m_lfDefFont);
	m_lfDefFontOld = m_lfDefFont;
	GetProfileFont(szPrintFont, &m_lfDefPrintFont);
	m_lfDefPrintFontOld = m_lfDefPrintFont;
}
bool CEsmScriptOptions::ReadFromRegistry (void) {
  CWinApp* pApp = AfxGetApp();
  bool	   Result;

	/* Input the background color */
  m_BackgroundColor = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_BGCOLOR, m_BackgroundColor);
  m_NoToolTips      = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOTOOLTIPS, (int) m_NoToolTips) != 0);

	/* Input the various char format and font options */
  Result  = ReadRegCharFormat();
  Result &= ReadRegFont();

  return (Result);
 }
Пример #8
0
void nPreUtilities::LoadSettings()
{
    SetDefaultSettings();

    CWinApp* pApp = AfxGetApp();
    bRunWithMinimizedMain = pApp->GetProfileInt("Settings", "RunWithMinimizedMain", bRunWithMinimizedMain);
}
Пример #9
0
void COptionsPage::OnButtonSource(void)
{
	CString strPrompt;

	strPrompt.LoadString(IDS_CHOOSE_SOURCE);
	CFolderDialog dlgFolder(strPrompt, m_strSource, this, BIF_NEWDIALOGSTYLE);
	if (dlgFolder.DoModal() == IDOK)
	{
		m_strSource = dlgFolder.GetFolderPath();
		SetDlgItemText(IDC_EDIT_SOURCE, m_strSource);
#if (_MFC_VER < 0x0700)
		CWinApp* pApp = AfxGetApp();
		ASSERT_VALID(pApp);
		if ((m_timeWrite = pApp->GetProfileInt(SZ_REGK_TIMES, m_strSource, -1)) != -1)
#else
		CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
		ASSERT_VALID(pApp);
		if ((m_timeWrite = pApp->GetProfileTime(SZ_REGK_TIMES, m_strSource, -1)) != -1)
#endif   // _MFC_VER
		{
			m_dtpWrite.SetTime(&m_timeWrite);
		}
		CString strDefTarget = m_strSource + _T(".Update");
		SetDlgItemText(IDC_EDIT_TARGET, pApp->GetProfileString(SZ_REGK_TARGETS, m_strSource, strDefTarget));
	}
}
Пример #10
0
//--------------------------------------------------------------------------------------------------------------//
UINT CChildView::GetProfileInt(LPCTSTR lpszEntry, int nDefault)
{
	UINT nResult = nDefault;
	CWinApp* pApp = AfxGetApp();
	if (pApp) nResult = pApp->GetProfileInt(REG_SECTION_LOG, lpszEntry, nDefault);
	return nResult;
}
Пример #11
0
BOOL CLeashProperties::OnInitDialog()
{
	CDialog::OnInitDialog();

    pLeashGetTimeServerName(timeServer, TIMEHOST);
    SetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer);

   	if (getenv(TIMEHOST))
        GetDlgItem(IDC_EDIT_TIME_SERVER)->EnableWindow(FALSE);
    else
        GetDlgItem(IDC_STATIC_TIMEHOST)->ShowWindow(FALSE);

    CWinApp * pApp = AfxGetApp();
    if (pApp)
        m_initMissingFiles = m_newMissingFiles =
            pApp->GetProfileInt("Settings", "CreateMissingConfig", FALSE_FLAG);
    CheckDlgButton(IDC_CHECK_CREATE_MISSING_CFG, m_initMissingFiles);

    dw_initMslsaImport = dw_newMslsaImport = pLeash_get_default_mslsa_import();
    switch ( dw_initMslsaImport ) {
    case 0:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_OFF,TRUE);
        break;
    case 1:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_ON,TRUE);
        break;
    case 2:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_MATCH,TRUE);
        break;
    }

    return TRUE;
}
Пример #12
0
CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
	: CDialog(IDD_TIP, pParent)
{
	//{{AFX_DATA_INIT(CTipDlg)
	m_bStartup = TRUE;
	//}}AFX_DATA_INIT

	// We need to find out what the startup and file position parameters are
	// If startup does not exist, we assume that the Tips on startup is checked TRUE.
	CWinApp* pApp = AfxGetApp();
	m_bStartup = !pApp->GetProfileInt(szSection, szIntStartup, 0);
	UINT iFilePos = pApp->GetProfileInt(szSection, szIntFilePos, 0);

	// Now try to open the tips file
	m_pStream = fopen("Tips.txt", "r");
	if (m_pStream == NULL)
	{
		m_strTip.LoadString(CG_IDS_FILE_ABSENT);
		return;
	}

	// If the timestamp in the INI file is different from the timestamp of
	// the tips file, then we know that the tips file has been modified
	// Reset the file position to 0 and write the latest timestamp to the
	// ini file
	struct _stat buf;
	_fstat(_fileno(m_pStream), &buf);
	CString strCurrentTime = ctime(&buf.st_ctime);
	strCurrentTime.TrimRight();
	CString strStoredTime = 
		pApp->GetProfileString(szSection, szTimeStamp, NULL);
	if (strCurrentTime != strStoredTime) 
	{
		iFilePos = 0;
		pApp->WriteProfileString(szSection, szTimeStamp, strCurrentTime);
	}

	if (fseek(m_pStream, iFilePos, SEEK_SET) != 0) 
	{
		AfxMessageBox(CG_IDP_FILE_CORRUPT);
	}
	else 
	{
		GetNextTipString(m_strTip);
	}
}
Пример #13
0
COptionsPage::COptionsPage(void):
CBetterPropPage(IDD_PAGE_OPTIONS),
m_nRecurse(BST_CHECKED),
m_nCleanup(BST_CHECKED),
m_nRecycle(BST_CHECKED),
m_fCompare(BST_UNCHECKED)
{
	m_psp.dwFlags |= PSP_PREMATURE;

#if (_MFC_VER < 0x0700)
	CWinApp* pApp = AfxGetApp();
#else
	CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
#endif   // _MFC_VER
	ASSERT_VALID(pApp);

	// initialize and validate initial input values

	m_strSource = pApp->GetConfigString(SZ_ARG_OPTIONS_SOURCE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_SOURCE);
	m_nRecurse = pApp->GetConfigCheck(SZ_ARG_OPTIONS_RECURSE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_RECURSE, BST_CHECKED);
	m_strExclude = pApp->GetConfigString(SZ_ARG_OPTIONS_EXCLUDE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_EXCLUDE);
	m_strTarget = pApp->GetConfigString(SZ_ARG_OPTIONS_TARGET, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_TARGET);

	m_nCleanup = pApp->GetConfigCheck(SZ_ARG_OPTIONS_CLEANUP, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_CLEANUP, BST_CHECKED);
	if (m_nCleanup == BST_CHECKED)
	{
		m_nRecycle = pApp->GetConfigCheck(SZ_ARG_OPTIONS_RECYCLE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_RECYCLE, BST_CHECKED);
	}
	else
	{
		m_nRecycle = BST_UNCHECKED;
	}

#if (_MFC_VER < 0x0700)
	m_timeWrite = m_strSource.IsEmpty() ? -1 : pApp->GetProfileInt(SZ_REGK_TIMES, m_strSource, -1);
#else
	CArgsParser& argsParser = pApp->m_argsParser;
	bool fHasWriteTime = false;
	if (argsParser.HasKey(SZ_ARG_OPTIONS_WRITETIME))
	{
		fHasWriteTime = argsParser.GetTimeValue(SZ_ARG_OPTIONS_WRITETIME, m_timeWrite);
	}
	if (!fHasWriteTime)
	{
		m_timeWrite = m_strSource.IsEmpty() ? -1 : pApp->GetProfileTime(SZ_REGK_TIMES, m_strSource, -1);
	}
#endif   // _MFC_VER

	m_fCompare = pApp->GetConfigCheck(SZ_ARG_OPTIONS_COMPARE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_COMPARE, BST_UNCHECKED);

	// initial validation
	if (!::PathFileExists(m_strSource))
	{
		::GetCurrentDirectory(_MAX_PATH, m_strSource.GetBuffer(_MAX_PATH));
		m_strSource.ReleaseBuffer();
		m_strTarget = m_strSource + _T(".Update");
	}
}
Пример #14
0
void CID3V2Page::RestoreTagBoxesState()
{
	CWinApp* myApp = AfxGetApp();
	
	int nValue = 1;

	nValue = myApp->GetProfileInt ("TagBoxes", "Artist2", 1);	
	m_Artistchk.SetCheck(nValue);
	m_Artist.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Title2", 1);	
	m_Titlechk.SetCheck(nValue);
	m_Title.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Album2", 1);
	m_Albumchk.SetCheck(nValue);
	m_Album.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Year2", 1);	
	m_Yearchk.SetCheck(nValue);
	m_Year.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Comment2", 1);	
	m_Commentchk.SetCheck(nValue);
	m_Comment.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Genre2", 1);		
	m_Genrechk.SetCheck(nValue);
	m_Genre.EnableWindow(nValue);
	nValue = myApp->GetProfileInt ("TagBoxes", "Track2", 1);
	m_Trackchk.SetCheck(nValue);
	m_Track.EnableWindow(nValue);

}
Пример #15
0
//Creating a new login profile
void CLogin::OnLoginNew() 
{
	CString name, host, zone, port;

	m_NameCombobox.GetWindowText(name);
	m_HostCombobox.GetWindowText(host);
	m_ZoneCombobox.GetWindowText(zone);
	m_PortCombobox.GetWindowText(port);

	CString new_profile_id = name + " in " + zone + " at " + host + " | " + port;

	CString tmp;

	for(int i = 0; i < m_ListBox.GetItemCount(); i++)
	{
		//tmp = m_ListBox.GetItemText(i, 0);
		tmp = m_prevLogins[i];
		if(0 == new_profile_id.Compare(tmp))
			return;		//the profile already exists - do nothing
	}

	CWinApp* pApp = AfxGetApp();

	char buf[256];

	UINT latest = pApp->GetProfileInt("History", "Latest", 0);

	if(0 == latest)
	{
		//there is no history - begin a new one.
		//never store anything in "History\\0"!
		latest = 1;
		sprintf(buf, "History\\1");
	}
	else
	{
		//create a new slot
		sprintf(buf, "History\\%d", ++latest);
	}

	//adding the new profile to the registry and incrementing latest
	pApp->WriteProfileInt("History", "Latest", latest);
	pApp->WriteProfileString(buf, "Name", name);
	pApp->WriteProfileString(buf, "Host", host);
	pApp->WriteProfileString(buf, "Zone", zone);
	pApp->WriteProfileString(buf, "Port", port);

	//add the new profile to the listbox - remember listbox is always one behind the registry!
	//m_ListBox.InsertItem(latest-1, new_profile_id, 0);
	int n = m_ListBox.InsertItem(latest-1, name);
	latest++;
	m_ListBox.SetItemText(n, 1, zone);
	m_ListBox.SetItemText(n, 2, host);
	m_ListBox.SetItemText(n, 3, port);

	m_prevLogins.Add(new_profile_id);
}
Пример #16
0
void 
TestRunnerModel::loadSettings(Settings & s)
{
  CWinApp *app = AfxGetApp();
  ASSERT( app != NULL );

  int autorun = app->GetProfileInt( _T("CppUnit"),
                                    _T("AutorunAtStartup"),
                                    1 );
  s.autorunOnLaunch = (autorun == 1);

  s.col_1 = app->GetProfileInt( _T("CppUnit"), _T("Col_1"), 40 );
  s.col_2 = app->GetProfileInt( _T("CppUnit"), _T("Col_2"), 40 );
  s.col_3 = app->GetProfileInt( _T("CppUnit"), _T("Col_3"), 40 );
  s.col_4 = app->GetProfileInt( _T("CppUnit"), _T("Col_4"), 40 );

  loadHistory();
}
bool CEsmScriptOptions::ReadRegFont (void) {
  CWinApp* pApp = AfxGetApp();
  CString  FontName = _T("FixedSys");
  int	   FontSize   = 8;
  int	   FontBold   = FW_NORMAL;
  int	   FontItalic = FALSE;
  
	/* Read the font options from the registry */
  FontSize   = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTSIZE, FontSize);
  FontBold   = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTBOLD, FontBold);
  FontItalic = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTITALIC, FontItalic);
  FontName   = pApp->GetProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTNAME, FontName);

	/* Create the font object */
  m_TextFont.Detach();
  CFONT_CREATE(m_TextFont, FontSize, FontBold, FontItalic, FontName);

  return (true);
 }
Пример #18
0
void CChatViewerStyle::init()
{
	theme.init();
	font.init();

	CWinApp* app = AfxGetApp();
	horzBorder = app->GetProfileInt( "Style", "horzBorder", horzBorder );

	fontChanged();
}
Пример #19
0
BOOL CGuiFrameWnd::PreCreateWindow(CREATESTRUCT& cs)
{
	// Restore main window position
	CWinApp* pApp = AfxGetApp();
	TCHAR szSection[256];
 	wsprintf(szSection, _T("%s-Main"), sProfile);

	// Restore main window position
    CWinApp* app = AfxGetApp();
    int s, t, b, r, l;

	l = pApp->GetProfileInt(szSection, _T("left"),10);
	t = pApp->GetProfileInt(szSection, _T("top"),10);
	b = pApp->GetProfileInt(szSection, _T("bottom"),400);
	r = pApp->GetProfileInt(szSection, _T("right"),600);
	s = pApp->GetProfileInt(szSection, _T("status"), SW_NORMAL);
	GuiDrawLayer::m_Style=(int)pApp->WriteProfileInt(szSection, _T("Style"),GUISTYLE_XP);
	GuiDrawLayer::m_Theme=(int)pApp->WriteProfileInt(szSection, _T("Theme"),0);

	// only restore if there is a previously saved position
	// restore the window's status
	app->m_nCmdShow = s;
                             
	// restore the window's width and height
	cs.cx = r - l;
	cs.cy = b - t;
                             
	// the following correction is needed when the taskbar is
    // at the left or top and it is not "auto-hidden"
	RECT workArea;
	SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
	l += workArea.left;
	t += workArea.top;
                             
	// make sure the window is not completely out of sight
	int max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON);
	int max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON);
	cs.x = min(l, max_x);
	cs.y = min(t, max_y);

	return CFrameWnd::PreCreateWindow(cs);
}
Пример #20
0
void AppSetting:: loadApplicationSetting()
{
	CWinApp* pApp = AfxGetApp();

	showNavigation = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_SHOW_NAVIGATION, 1) != 0;//0 -> false; 1 -> true

	bShowHelpText = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_TEXT, 1) != 0;
	bShowAxis = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_AXIS, 1) != 0;
	objPath = pApp->GetProfileString(REGKEY_APP_NAME, REGKEY_OBJECT_PATH);
	simulationDataPath = pApp->GetProfileString(REGKEY_APP_NAME, REGKEY_SIM_DATA_PATH);

	CHAR my_documents[MAX_PATH];
	HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
	CString documentPath(my_documents);
	documentPath.AppendFormat("\\%s", SETTING_NAME);
	if (GetFileAttributes(documentPath) == INVALID_FILE_ATTRIBUTES)
	{
		CreateDirectory(documentPath,NULL);
	}
}
Пример #21
0
void CPlayerBar::LoadState(CFrameWnd *pParent)
{
	CWinApp* pApp = AfxGetApp();

	CRect r;
	pParent->GetWindowRect(r);
	CRect rDesktop;
	GetDesktopWindow()->GetWindowRect(&rDesktop);

	CString section = _T("ToolBars\\") + m_strSettingName;

	__super::LoadState(section + _T("\\State"));

	UINT dockBarID = pApp->GetProfileInt(section, _T("DockState"), m_defDockBarID);

	if (dockBarID == AFX_IDW_DOCKBAR_FLOAT) {
		CPoint p;
		p.x = pApp->GetProfileInt(section, _T("DockPosX"), r.right);
		p.y = pApp->GetProfileInt(section, _T("DockPosY"), r.top);

		if (p.x < rDesktop.left) {
			p.x = rDesktop.left;
		}

		if (p.y < rDesktop.top) {
			p.y = rDesktop.top;
		}

		if (p.x >= rDesktop.right) {
			p.x = rDesktop.right-1;
		}

		if (p.y >= rDesktop.bottom) {
			p.y = rDesktop.bottom-1;
		}

		pParent->FloatControlBar(this, p);
	} else {
		pParent->DockControlBar(this, dockBarID);
	}
}
Пример #22
0
void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
{
    ASSERT_VALID(this);
    ASSERT(GetSafeHwnd()); // must be called after Create()

    CWinApp* pApp = AfxGetApp();

    TCHAR szSection[256];
    wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
        GetDlgCtrlID());

    m_szHorz.cx = max(m_szMin.cx, (int) pApp->GetProfileInt(szSection,
        _T("sizeHorzCX"), m_szHorz.cx));
    m_szHorz.cy = max(m_szMin.cy, (int) pApp->GetProfileInt(szSection, 
        _T("sizeHorzCY"), m_szHorz.cy));

    m_szVert.cx = max(m_szMin.cx, (int) pApp->GetProfileInt(szSection, 
        _T("sizeVertCX"), m_szVert.cx));
    m_szVert.cy = max(m_szMin.cy, (int) pApp->GetProfileInt(szSection, 
        _T("sizeVertCY"), m_szVert.cy));

    m_szFloat.cx = max(m_szMin.cx, (int) pApp->GetProfileInt(szSection,
        _T("sizeFloatCX"), m_szFloat.cx));
    m_szFloat.cy = max(m_szMin.cy, (int) pApp->GetProfileInt(szSection,
        _T("sizeFloatCY"), m_szFloat.cy));
}
Пример #23
0
BOOL CPlayerDialog::IsAppNormalExit()
{
	CWinApp* pApp = AfxGetApp();
	UINT dwStatus = pApp->GetProfileInt(L"AppStatus",L"Status",APP_FIRSTRUN);
	if(dwStatus != APP_NORMALEXIT)
	{
		return FALSE;
	}
	else
	{
		return TRUE;
	}
}
Пример #24
0
CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
	: CDialog(IDD_TIP, pParent)
{
	//{{AFX_DATA_INIT(CTipDlg)
	m_bStartup = TRUE;
	//}}AFX_DATA_INIT

	m_bStartup = g_bStartTipsByDefault;

	// We need to find out what the startup and file position parameters are
	// If startup does not exist, we assume that the Tips on startup is checked TRUE.
	CWinApp* pApp = AfxGetApp();
	m_bStartup = pApp->GetProfileInt(g_szTipsSection, g_szTipsIntStartup, g_bStartTipsByDefault );
	UINT iFilePos = pApp->GetProfileInt(g_szTipsSection, g_szTipsIntFilePos, 0);

	m_strTips = LocLoadString( IDS_TIPS );
	m_iTipPos = iFilePos;

	{
		GetNextTipString(m_strTip);
	}
}
Пример #25
0
//this code from codeguru by Yonat Sharon
BOOL CStudioMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	//    // Restore main window position    //
	CWinApp* app = AfxGetApp();
	int s, t, b, r, l;
	// only restore if there is a previously saved position
	if ( -1 != (s = app->GetProfileInt(_T("Frame"), _T("Status"),   -1)) &&
		 -1 != (t = app->GetProfileInt(_T("Frame"), _T("Top"),      -1)) &&
		 -1 != (l = app->GetProfileInt(_T("Frame"), _T("Left"),     -1)) &&
		 -1 != (b = app->GetProfileInt(_T("Frame"), _T("Bottom"),   -1)) &&
		 -1 != (r = app->GetProfileInt(_T("Frame"), _T("Right"),    -1))       )
	{
		// don't keep a minimized state
		if(s == SW_SHOWMINIMIZED   )
		{
			s = SW_RESTORE;
		}
		// restore the window's status
		app->m_nCmdShow = s;
		// restore the window's width and height
		cs.cx = r - l;
		cs.cy = b - t;
		// the following correction is needed when the taskbar is
		// at the left or top and it is not "auto-hidden"
		RECT workArea;
		SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
		l += workArea.left;
		t += workArea.top;
		// make sure the window is not completely out of sight
		int max_x = GetSystemMetrics(SM_CXSCREEN) -
						GetSystemMetrics(SM_CXICON);
		int max_y = GetSystemMetrics(SM_CYSCREEN) -
						GetSystemMetrics(SM_CYICON);
		cs.x = min(l, max_x);
		cs.y = min(t, max_y);
	}
	return CMDIFrameWnd::PreCreateWindow(cs);
}
Пример #26
0
//////////////////
// Get window placement from profile.
void CWindowPlacement::GetProfileWP(LPCTSTR lpKeyName)
{
   CWinApp *pApp = AfxGetApp();
   ASSERT_VALID(pApp);

   showCmd = pApp->GetProfileInt(lpKeyName, _T("wp.showCmd"), showCmd);
   flags   = pApp->GetProfileInt(lpKeyName, _T("wp.flags"), flags);

ptMinPosition.x = pApp->GetProfileInt(lpKeyName, _T("wp.ptMinPosition.x"), 
      ptMinPosition.x);
ptMinPosition.y = pApp->GetProfileInt(lpKeyName, _T("wp.ptMinPosition.y"),
      ptMinPosition.y);
ptMaxPosition.x = pApp->GetProfileInt(lpKeyName, _T("wp.ptMaxPosition.x"), 
      ptMaxPosition.x);
ptMaxPosition.y = pApp->GetProfileInt(lpKeyName, _T("wp.ptMaxPosition.y"),
      ptMaxPosition.y);

   RECT& rc = rcNormalPosition;  // because I hate typing
   rc.left  = pApp->GetProfileInt(lpKeyName, _T("wp.left"),   rc.left);
   rc.right = pApp->GetProfileInt(lpKeyName, _T("wp.right"),  rc.right);
   rc.top   = pApp->GetProfileInt(lpKeyName, _T("wp.top"),    rc.top);
   rc.bottom= pApp->GetProfileInt(lpKeyName, _T("wp.bottom"), rc.bottom);
}
void CXTPRecentFileList::ReadList()
{
	ASSERT(m_arrNames != NULL);
	ASSERT(!m_strSectionName.IsEmpty());
	ASSERT(!m_strEntryFormat.IsEmpty());

	LPTSTR pszEntry = new TCHAR[max(20, m_strEntryFormat.GetLength() + 7)];
	CWinApp* pApp = AfxGetApp();

	for (int iMRU = 0; iMRU < m_nSize; iMRU++)
	{
		CMDTARGET_RELEASE(m_pItems[iMRU]);

		wsprintf(pszEntry, m_strEntryFormat, iMRU + 1);
		m_arrNames[iMRU] = pApp->GetProfileString(m_strSectionName, pszEntry, _T(""));

		if (!m_arrNames[iMRU].IsEmpty())
		{
			m_pItems[iMRU] = new CXTPRecentFileListItem(this);

			wsprintf(pszEntry, _T("Pinned%d"), iMRU + 1);
			m_pItems[iMRU]->m_bPinned = pApp->GetProfileInt(m_strSectionName, pszEntry, FALSE);

			wsprintf(pszEntry, _T("IconId%d"), iMRU + 1);
			m_pItems[iMRU]->m_nIconId = pApp->GetProfileInt(m_strSectionName, pszEntry, -1);

			wsprintf(pszEntry, _T("Caption%d"), iMRU + 1);
			m_pItems[iMRU]->m_strCaption = pApp->GetProfileString(m_strSectionName, pszEntry, _T(""));

			wsprintf(pszEntry, _T("Tag%d"), iMRU + 1);
			m_pItems[iMRU]->m_strTag = pApp->GetProfileString(m_strSectionName, pszEntry, _T(""));

			m_pItems[iMRU]->m_strPathName = m_arrNames[iMRU];
		}
	}
	delete[] pszEntry;
}
Пример #28
0
BOOL CServerSettings::LoadServerFromRegistry(const char* ctx)
{
	CWinApp* pApp = AfxGetApp();
	CString S;
	//int k, nSize;
	//char szKey[32];
	TCHAR szValue[256];

	int   nDefault_Port                       = 119;
	char *szDefault_Server                   = m_szServerName;
	char *szDefault_Username                 = m_szUsername;
	char *szDefault_Password                 = m_szPassword;

	m_nServerPort = pApp->GetProfileInt(ctx,"NNTP_Port",	nDefault_Port);

	S = pApp->GetProfileString(ctx,"Server", szDefault_Server);
	if((S.GetLength() > 2*132) || (S.GetLength() == 0)) S = szDefault_Server;
	strcpy(m_szServerName, (LPCTSTR) S);

	m_bRequireLogin = pApp->GetProfileInt(ctx,"Login", FALSE);
	if((m_bRequireLogin != TRUE) && (m_bRequireLogin != FALSE)) m_bRequireLogin = FALSE;

	m_nConnections = pApp->GetProfileInt(ctx,"Connections", 1);
	if(m_nConnections <1) m_nConnections = 1; else if (m_nConnections>NPOSTTHREAD) m_nConnections=NPOSTTHREAD;

	S = pApp->GetProfileString(ctx,"User", szDefault_Username);
	if((S.GetLength() > 132) || (S.GetLength() == 0))  S = szDefault_Username;
	strcpy(m_szUsername, (LPCTSTR) S);

	S = pApp->GetProfileString(ctx,"Pass", szDefault_Password);
	if((S.GetLength() > 132) || (S.GetLength() == 0)) S = szDefault_Password;
	strcpy(szValue, (LPCTSTR) S);
	::CM_UnMixString(szValue, m_szPassword, 132);
	TRACE("PASSWORD READ: from '%s' TO '%s'\n", szValue, m_szPassword);
	return TRUE;
}
Пример #29
0
void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
{
    ASSERT_VALID(this);
    ASSERT(GetSafeHwnd()); // must be called after Create()

#if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
    // compensate the caption miscalculation in CFrameWnd::SetDockState()
    CDockState state;
    state.LoadState(lpszProfileName);

    UINT nID = GetDlgCtrlID();
    for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
    {
        CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
        ASSERT(pInfo != NULL);
        if (!pInfo->m_bFloating)
            continue;
        
        // this is a floating dockbar - check the ID array
        for (int j = 0; j < pInfo->m_arrBarID.GetSize(); j++)
            if ((DWORD) pInfo->m_arrBarID[j] == nID)
            {
                // found this bar - offset origin and save settings
                pInfo->m_pointPos.x++;
                pInfo->m_pointPos.y +=
                    ::GetSystemMetrics(SM_CYSMCAPTION) + 1;
                pInfo->SaveState(lpszProfileName, i);
            }
    }
#endif //_SCB_REPLACE_MINIFRAME && !_SCB_MINIFRAME_CAPTION

    CWinApp* pApp = AfxGetApp();

    TCHAR szSection[256];
    wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
        GetDlgCtrlID());

    m_szHorz.cx = max(m_szMinHorz.cx, (int) pApp->GetProfileInt(
        szSection, _T("sizeHorzCX"), m_szHorz.cx));
    m_szHorz.cy = max(m_szMinHorz.cy, (int) pApp->GetProfileInt(
        szSection, _T("sizeHorzCY"), m_szHorz.cy));

    m_szVert.cx = max(m_szMinVert.cx, (int) pApp->GetProfileInt(
        szSection, _T("sizeVertCX"), m_szVert.cx));
    m_szVert.cy = max(m_szMinVert.cy, (int) pApp->GetProfileInt(
        szSection, _T("sizeVertCY"), m_szVert.cy));

    m_szFloat.cx = max(m_szMinFloat.cx, (int) pApp->GetProfileInt(
        szSection, _T("sizeFloatCX"), m_szFloat.cx));
    m_szFloat.cy = max(m_szMinFloat.cy, (int) pApp->GetProfileInt(
        szSection, _T("sizeFloatCY"), m_szFloat.cy));
}
void CSTWSelectTmplPage::OnButtonDelete() 
{
	if (AfxMessageBox (IDS_CONFIRM_DELETETEMPLATE, MB_ICONQUESTION | MB_YESNO) == IDYES)
	{
		CString strTemplate;
		m_Combo.GetWindowText (strTemplate);
		if (strTemplate.IsEmpty ())
			return;

		// get the number of templates
		CWinApp* pApp = AfxGetApp ();
		int nCount = pApp->GetProfileInt ("Templates", "Count", 0);
		CString s, strName;
		bool bMove = false;

		// delete from the list
		for (int i = 1; i <= nCount; i++)
		{
			if (bMove)
			{
				s.Format ("%d", i);
				strName = pApp->GetProfileString ("Templates", s);
				s.Format ("%d", i - 1);
				pApp->WriteProfileString ("Templates", s, strName);
			}

			s.Format ("%d", i);
			if (pApp->GetProfileString ("Templates", s) == strTemplate)
				bMove = true;
		}

		pApp->WriteProfileInt ("Templates", "Count", nCount - 1);

		// delete the template's settings
		DWORD dwRet = SHDeleteKey (HKEY_CURRENT_USER, "Software\\CdCoverCreator\\Templates\\" + strTemplate);

		// remove from the combo box
		m_Combo.DeleteString (m_Combo.FindStringExact (-1, strTemplate));
	}
}