1 //*******************************************************************************
4 // You may use this source code, compile or redistribute it as part of your application
5 // for free. You cannot redistribute it as a part of a software development
6 // library without the agreement of the author. If the sources are
7 // distributed along with the application, you should leave the original
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
18 // IEShellListView.cpp : implementation file
21 #include "IEShellListView.h"
26 static char THIS_FILE[] = __FILE__;
29 /////////////////////////////////////////////////////////////////////////////
32 IMPLEMENT_DYNCREATE(CIEShellListView,CUIListView)
34 CIEShellListView::CIEShellListView()
35 : CUIListView(IDC_LIST_SHELL)
41 CIEShellListView::~CIEShellListView()
45 void CIEShellListView::SetActiveWindow(CWnd *pWnd)
48 if (pWnd->GetSafeHwnd() == NULL)
50 if (m_pActiveWnd->GetSafeHwnd() == pWnd->GetSafeHwnd())
53 m_pActiveWnd->GetWindowRect(rect);
54 ScreenToClient(&rect);
55 m_pActiveWnd->ShowWindow(SW_HIDE);
58 m_pActiveWnd->ShowWindow(SW_SHOW);
59 m_pActiveWnd->MoveWindow(&rect);
62 void CIEShellListView::LoadShellFolderItems(const CRefreshShellFolder &rFolder)
64 LPTVITEMDATA lptvid = reinterpret_cast<LPTVITEMDATA>(rFolder.GetItemData());
67 GetShellListCtrl().Populate(lptvid);
70 BEGIN_MESSAGE_MAP(CIEShellListView, CUIListView)
71 //{{AFX_MSG_MAP(CIEShellListView)
72 ON_MESSAGE(WM_SETMESSAGESTRING,OnSetmessagestring)
73 ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS,OnAppUpdateAllViews)
75 // NOTE - the ClassWizard will add and remove mapping macros here.
77 ON_MESSAGE(WM_APP_CB_IE_SEL_CHANGE,OnCBIESelChange)
78 ON_MESSAGE(WM_APP_CB_IE_HIT_ENTER,OnCBIEHitEnter)
81 /////////////////////////////////////////////////////////////////////////////
82 // CIEShellListView message handlers
84 void CIEShellListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
86 // TODO: Add your specialized code here and/or call the base class
87 if (lHint == HINT_TREE_SEL_CHANGED)
89 GetListCtrl().SendMessage(WM_APP_UPDATE_ALL_VIEWS,(WPARAM)lHint,(LPARAM)pHint);
93 void CIEShellListView::CreateListCtrl()
95 // TODO: Add your specialized code here and/or call the base class
96 m_pListCtrl = new CIEShellListCtrl;
97 m_pActiveWnd = m_pListCtrl;
100 CIEShellListCtrl &CIEShellListView::GetShellListCtrl()
102 // TODO: Add your specialized code here and/or call the base class
104 return static_cast<CIEShellListCtrl&>(GetListCtrl());
107 LRESULT CIEShellListView::OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam)
109 if (wParam == HINT_TREE_INTERNET_FOLDER_SELECTED)
113 if (m_htmlCtrl.GetSafeHwnd() == NULL)
115 if (m_htmlCtrl.Create(NULL, // class name
117 (WS_CHILD | WS_VISIBLE), // style
118 CRect(), // rectangle
121 NULL)) // frame/doc context not use
123 m_htmlCtrl.SetNotifyWnd(GetParentFrame()->GetSafeHwnd());
128 GetParentFrame()->SendMessage(WM_APP_CB_IE_SET_EDIT_TEXT,(WPARAM)(LPCTSTR)m_htmlCtrl.GetLocationURL(),0);
129 SetActiveWindow(&m_htmlCtrl);
132 SetActiveWindow(m_pListCtrl);
137 void CIEShellListView::OnSize(UINT nType, int cx, int cy)
139 // TODO: Add your message handler code here
140 if (m_pActiveWnd && m_pActiveWnd->GetSafeHwnd())
141 m_pActiveWnd->MoveWindow(0,0,cx,cy);
143 CView::OnSize(nType, cx, cy);
146 LRESULT CIEShellListView::OnCBIESelChange(WPARAM wParam,LPARAM lParam)
148 if (m_pActiveWnd->GetSafeHwnd() == m_htmlCtrl.GetSafeHwnd())
152 m_htmlCtrl.Navigate((LPCTSTR)lParam);
157 LRESULT CIEShellListView::OnCBIEHitEnter(WPARAM wParam,LPARAM lParam)
159 if (m_pActiveWnd->GetSafeHwnd() == m_htmlCtrl.GetSafeHwnd())
163 m_htmlCtrl.Navigate((LPCTSTR)lParam);
168 LRESULT CIEShellListView::OnSetmessagestring(WPARAM wParam, LPARAM lParam)
170 CFrameWnd *pFrame = GetParentFrame();
172 return pFrame->SendMessage(WM_SETMESSAGESTRING,wParam,lParam);