📄 dialogfav.cpp
字号:
// DialogFav.cpp : implementation file
//
#include "stdafx.h"
#include "IE6mdi.h"
#include "DialogFav.h"
#include "IE6mdiView.h"
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogFav dialog
CDialogFav::CDialogFav(CWnd* pParent /*=NULL*/)
: CDialog(CDialogFav::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialogFav)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDialogFav::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogFav)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogFav, CDialog)
//{{AFX_MSG_MAP(CDialogFav)
ON_NOTIFY(TVN_SELCHANGED, IDC_DIRTREE, OnSelchangedDirtree)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogFav message handlers
BOOL CDialogFav::OnInitDialog()
{
CDialog::OnInitDialog();
// First step // subclassing the DirTreeCtrl
m_DirTree.SubclassDlgItem( IDC_DIRTREE, this );
// next step
// setting the StartPath if NULL the DirTreeCtrl
// displays all drives on this PC
m_DirTree.DisplayTree( m_DefaultPath,
TRUE);
char szWorkDir[256];
_getcwd( szWorkDir, 256 );
// set the Path to the current Work-Directory
m_DirTree.SetSelPath( szWorkDir );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDialogFav::OnSelchangedDirtree(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Code f黵 die Behandlungsroutine der Steuerelement-Benachrichtigung hier einf黦en
m_strPathName = m_DirTree.GetFullPath( pNMTreeView->itemNew.hItem );
if (m_strPathName.Right(5) == ".url") {
CMDIChildWnd *pChild = (CMDIChildWnd *) m_pMain->GetActiveFrame();
CIE6mdiView *pView = (CIE6mdiView *) pChild->GetActiveView();
CFile file;
if (!file.Open(m_strPathName, CFile::modeRead))
{
// an error occured
AfxMessageBox(CString(LPCTSTR(IDS_FILEERROR)));
return;
}
char *buf = (char*)malloc((file.GetLength()+1)*sizeof(char));
buf[0]='\0';
file.Read(buf,file.GetLength());
file.Close();
CString s(buf);
free(buf);
// we have to remove
int pos = s.Find("URL=");
if (pos == -1) // error ?!??!?
return;
s = s.Mid(pos+4);
pos = s.Find("Modified");
if (pos != -1) {
// remove everything after...
s = s.Left(pos);
}
if (pView == NULL) {
AfxGetApp()->m_pMainWnd->SendMessage(WM_COMMAND,(WPARAM)ID_FILE_NEW,(LPARAM)NULL);
pChild = (CMDIChildWnd *) m_pMain->GetActiveFrame();
pView = (CIE6mdiView *) pChild->GetActiveView();
pView->Navigate2(s);
return;
}
else
pView->Navigate2(s);
}
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -