#include "stdafx.h" #include "NoteSeeFrame.h" #include "GlobalUI.h" #include "DialogCallbackEx.h" namespace DuiLib { CNoteSeeFrame::CNoteSeeFrame(MyPDFBook * book) { //m_pMyPDFBook=book; } CNoteSeeFrame::~CNoteSeeFrame(void) { } void CNoteSeeFrame::Notify(TNotifyUI& msg) { if( msg.sType == _T("click") ) { if (msg.pSender->GetName() == _T("ok_button")) { Close(IDOK); return; } else if(msg.pSender->GetName() == _T("close_button")) { Close(); } } __super::Notify(msg); } void CNoteSeeFrame::OnInit() { //CreateControl(_T("MyPDFReader")); m_pMyPDFBook= static_cast<MyPDFBook*>(m_pm.FindControl(_T("MyPDFReader"))); m_pMyPDFBook->Open(_T("E:\\chinese_code\\READER\\YDJL\\debug\\source\\public\\YWSHKJQGVV03020001-2017-1956\\XB-2009015-18S-01-01.pdf")); __super::OnInit(); } void CNoteSeeFrame::OnLoad() { __super::OnLoad(); } LRESULT CNoteSeeFrame::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return __super::HandleMessage(uMsg, wParam, lParam); } CControlUI* CNoteSeeFrame::CreateControl( LPCTSTR pstrClass ) { // if(_tcsicmp(pstrClass, _T("MyPDFReader")) == 0) // { // m_pMyPDFBook=new MyPDFBook; // return m_pMyPDFBook; // } return NULL; } LRESULT CNoteSeeFrame::OnCreate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { m_pm.Init(m_hWnd); CDialogBuilder builder; CDialogBuilderCallbackEx cb(this, m_hWnd); /*�ڶ�ȡ��Դ֮ǰ��������Դ·��*/ //CSkinBuilder::SetModuleName(_T("1920")); int cxScreen = GetSystemMetrics(SM_CXSCREEN); CControlUI* pRoot; pRoot = builder.Create(_T("reader\\NoteSeeFrame.xml"), (UINT)0, &cb, &m_pm); DuiLib::CDuiString resPath=DuiLib::CPaintManagerUI::GetResourcePath(); ASSERT(pRoot && "Failed to parse XML"); m_pm.AttachDialog(pRoot); m_pm.AddNotifier(this); RECT rt; SystemParametersInfo(SPI_GETWORKAREA,NULL, &rt,NULL); POINT pt; int width = GetSystemMetrics(SM_CXFULLSCREEN); int height = rt.bottom; int iWidth; int iHeight; if(g_bScreenShow) { iWidth = 800; iHeight = 90; } else { iWidth = 400; iHeight = 45; } pt.y = height - iHeight; pt.x = width / 2; pt.x = pt.x - iWidth / 2; ClientToScreen(this->m_hWnd, &pt); return 0; } }