#include "SRReaderApp.h" #include "SwordReaderResource.h" SRReaderApp::SRReaderApp(HINSTANCE hInstance) : SRFramework::SRApp(hInstance) , m_pMainFrame(NULL) { m_hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_BIBLEREADER); } SRReaderApp::~SRReaderApp() { if(m_pMainFrame) delete m_pMainFrame; } WPARAM SRReaderApp::Run() { MSG msg; bool ignoreMsgs = false; DWORD ignoreTill = GetTickCount(); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if(msg.message == WM_TXT_START){ ignoreMsgs = true; }else if(msg.message == WM_TXT_END){ ignoreMsgs = false; ignoreTill = msg.time; } // If we have a button or key event, and we are in the ignore message // window of time we ignore this message if((msg.message == WM_LBUTTONDOWN || msg.message == WM_KEYDOWN) && (ignoreMsgs || msg.time < ignoreTill)) continue; if (!m_hAccelTable || !TranslateAccelerator(msg.hwnd, m_hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } BOOL SRReaderApp::InitApp(int nCmdShow) { m_pMainFrame = new SRMainFrame(); if(!m_pMainFrame->Create()) return FALSE; if(!m_pMainFrame->Init()) return FALSE; return TRUE; } BOOL SRReaderApp::RefreshWindows() { return m_pMainFrame->UpdateWindow(); }