00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "fsClipboardCatchMgr.h"
00009 #include "fsIECatchMgr.h"
00010
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #undef THIS_FILE
00014 static char THIS_FILE[] = __FILE__;
00015 #endif
00016
00017 fsClipboardCatchMgr::fsClipboardCatchMgr()
00018 {
00019 m_bEnabled = FALSE;
00020 }
00021
00022 fsClipboardCatchMgr::~fsClipboardCatchMgr()
00023 {
00024 }
00025
00026 BEGIN_MESSAGE_MAP(fsClipboardCatchMgr, CWnd)
00027
00028 ON_WM_DRAWCLIPBOARD()
00029 ON_WM_CHANGECBCHAIN()
00030
00031 END_MESSAGE_MAP()
00032
00033 BOOL fsClipboardCatchMgr::Create(CWnd *pParent)
00034 {
00035 CRect rc (0, 0, 0, 0);
00036 if (FALSE == CWnd::Create (NULL, NULL, WS_CHILD, rc, pParent, 0x129978))
00037 return FALSE;
00038
00039 ShowWindow (SW_HIDE);
00040
00041 return TRUE;
00042 }
00043
00044 void fsClipboardCatchMgr::Enable(BOOL bEnable)
00045 {
00046 if (bEnable)
00047 {
00048 if (m_bEnabled == FALSE)
00049 {
00050 m_hNextViewer = SetClipboardViewer ();
00051 m_bEnabled = TRUE;
00052 }
00053 }
00054 else
00055 {
00056 if (m_bEnabled)
00057 {
00058 ChangeClipboardChain (m_hNextViewer);
00059 m_bEnabled = FALSE;
00060 }
00061 }
00062 }
00063
00064 void fsClipboardCatchMgr::OnDrawClipboard()
00065 {
00066 LPCSTR pszUrl = _ClipbrdMgr.Text ();
00067
00068 if (pszUrl)
00069 {
00070
00071 if (lstrlen (pszUrl) > 3 && pszUrl [1] != ':' && pszUrl [2] != ':')
00072 if (m_strLastUrl != pszUrl)
00073 {
00074 m_strLastUrl = pszUrl;
00075 if (m_pIEMgr->OnBeforeNavigate (pszUrl, FALSE) == FALSE)
00076 return;
00077 }
00078 }
00079
00080 if (IsWindow (m_hNextViewer))
00081 ::PostMessage (m_hNextViewer, WM_DRAWCLIPBOARD, 0, 0);
00082 }
00083
00084 void fsClipboardCatchMgr::OnChangeCbChain(HWND hWndRemove, HWND hWndAfter)
00085 {
00086 if (m_hNextViewer == hWndRemove)
00087 m_hNextViewer = hWndAfter;
00088 else if (IsWindow (m_hNextViewer))
00089 ::PostMessage (m_hNextViewer, WM_CHANGECBCHAIN, WPARAM (hWndRemove), LPARAM (hWndAfter));
00090 }
00091
00092 BOOL fsClipboardCatchMgr::IsEnabled()
00093 {
00094 return m_bEnabled;
00095 }
00096
00097 void fsClipboardCatchMgr::Initialize(fsIECatchMgr *iemgr)
00098 {
00099 m_pIEMgr = iemgr;
00100 }