Пример #1
0
BOOL CRuntimeDlg::OnInitDialog() 
{
	// first init borders if set in DLU
	if (!m_rBordersDLU.IsRectNull())
		SetBordersDLU(m_rBordersDLU.left, m_rBordersDLU.top, m_rBordersDLU.right, m_rBordersDLU.bottom);
	
	// make sure we create the controls before calling the base class
	CreateControls();
	
	CDialog::OnInitDialog();
	
	// add icons only if we have no parent
	CWnd* pParent = GetParent();

	if (!pParent)
	{
		CString sAppPath = FileMisc::GetAppFileName();
		
		if (::ExtractIconEx(sAppPath, 0, &m_hILarge, &m_hISmall, 1))
		{
			SetIcon(m_hILarge ? m_hILarge : m_hISmall, TRUE);
			SetIcon(m_hISmall ? m_hISmall : m_hILarge, FALSE);
		}
	}

	// set font to parent's if poss
	HFONT hFont = pParent ? (HFONT)pParent->SendMessage(WM_GETFONT) : NULL;

	if (!hFont)
	{
		// use appropriate system font
		NONCLIENTMETRICS ncm;
		ZeroMemory(&ncm,sizeof(ncm));
		ncm.cbSize = sizeof(ncm);
		
		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, (PVOID)&ncm, FALSE);
	
		hFont = ::CreateFontIndirect(&ncm.lfMessageFont);
			
		if (!hFont)
			hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		else
			m_hFont = hFont; // so we can clean up
	}

	ASSERT (hFont);
	SetFont(hFont, FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Пример #2
0
CRuntimeDlg::CRuntimeDlg(CWnd* pParentWnd, LPCTSTR szSettingsKey) 
: 
	CDialog((LPCTSTR)NULL, pParentWnd),
	m_sSettingsKey(szSettingsKey), 
	m_hILarge(NULL), 
	m_hISmall(NULL), 
	m_rBordersDLU(0), 
	m_rBorders(0),
	m_hFont(NULL)
{
	if (!s_mapClasses.GetCount())
		BuildClassMap();
	
	SetBordersDLU(7);
}
Пример #3
0
CRemoteFileDialog::CRemoteFileDialog(CFtpConnection* pConnection, LPCTSTR szServer, LPCTSTR szFilters,
	LPCTSTR szInitialFolder):
m_pConnection(pConnection),
m_sServer(szServer),
m_sCurFolder(szInitialFolder),
m_eCurFolder(FES_NOBROWSE | FES_FOLDERS),
m_eFilename(FES_NOBROWSE),
m_bRoot(FALSE),
m_dwFileSize(0),
m_silLarge(TRUE),
m_silSmall(FALSE),
m_bInitReport(FALSE),
m_dwOptions(0),
m_bFilling(FALSE)
{
	//{{AFX_DATA_INIT(CRemoteFileDialog)
	//}}AFX_DATA_INIT
	SetBordersDLU(3);

	AddRCControl(_T("SCROLLBAR"), _T(""), _T(""), SBS_RIGHTALIGN, 0, 270, 160, 8, 16, IDC_GRIPPER);
	AddRCControl(_T("EDITTEXT"), _T(""), _T(""), ES_AUTOHSCROLL | WS_TABSTOP, 0, 74, 144, 154, 13, IDC_FILENAME);
	AddRCControl(_T("LTEXT"), _T(""), _T("Files of &type:"), 0, 0, 0, 164, 40, 8, IDC_FILETYPESLABEL);
	AddRCControl(_T("COMBOBOX"), _T(""), _T(""), CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP, 0, 74, 163, 154,
		100, IDC_FILETYPES);
	AddRCControl(_T("DEFPUSHBUTTON"), _T(""), _T("OK"), WS_TABSTOP, 0, 230, 143, 50, 14, IDOK);
	AddRCControl(_T("PUSHBUTTON"), _T(""), _T("Cancel"), WS_TABSTOP, 0, 230, 162, 50, 14, IDCANCEL);
	AddRCControl(_T("LTEXT"), _T(""), _T("Current Folder:"), 0, 0, 0, 7, 47, 8, IDC_CURFOLDERLABEL);
	AddRCControl(_T("EDITTEXT"), _T(""), _T(""), ES_AUTOHSCROLL | ES_READONLY, 0, 58, 4, 210, 14, IDC_CURRENTFOLDER);
	AddRCControl(_T("CONTROL"), _T("SysListView32"), _T(""), LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_LIST |
		LVS_SHAREIMAGELISTS | WS_TABSTOP, WS_EX_CLIENTEDGE, 0, 22, 280, 114, IDC_FILELIST);
	AddRCControl(_T("LTEXT"), _T(""), _T("Remote file &name:"), 0, 0, 0, 146, 66, 8, IDC_FILENAMELABEL);

	InitFilterArray(szFilters);

	if (m_sCurFolder.IsEmpty())
	{
		m_sCurFolder = AfxGetApp()->GetProfileString(_T("RemoteSettings\\LastFolder"), m_sServer);
	}

	if (m_sCurFolder.IsEmpty())
	{
		m_pConnection->GetCurrentDirectory(m_sCurFolder);
	}
}