📄 alarm.cpp
字号:
// Alarm.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Alarm.h"
#include "AlarmWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAlarmApp
BEGIN_MESSAGE_MAP(CAlarmApp, CWinApp)
//{{AFX_MSG_MAP(CAlarmApp)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAlarmApp construction
CAlarmApp::CAlarmApp()
: m_bWindowIsTopmost(TRUE)
, m_iClock24Hour(-1)
, m_iClockMinute(-1)
, m_iClockSecond(-1)
, m_iAlarm24Hour(7)
, m_iAlarmMinute(15)
, m_bSpeakClock(FALSE)
, m_iStyle(0)
, m_bAlarmActive(TRUE)
, m_bGrayLetters(FALSE)
, m_iSpeakIntervals(0)
, m_b12HourBase(TRUE)
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CAlarmApp object
CAlarmApp alarmApp, *pAlarmApp; // Instantiate application.
/////////////////////////////////////////////////////////////////////////////
// CAlarmApp initialization
BOOL CAlarmApp::InitInstance()
{
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
SetRegistryKey(_T("Software Service ABB"));
m_bWindowIsTopmost = GetProfileInt("Settings", "WindowIsTopmost", TRUE);
m_bSpeakClock = GetProfileInt("Settings", "SpeakClock", FALSE);
m_iStyle = GetProfileInt("Settings", "Style", 0);
m_bAlarmActive = GetProfileInt("Settings", "AlarmActive", TRUE);
m_iAlarm24Hour = GetProfileInt("Settings", "Alarm24Hour", 7);
m_iAlarmMinute = GetProfileInt("Settings", "AlarmMinute", 15);
m_bGrayLetters = GetProfileInt("Settings", "GrayLetters", 0);
m_iSpeakIntervals = GetProfileInt("Settings", "SpeakIntervals", 0);
m_xPos = GetProfileInt("Settings", "xPos", -1);
m_yPos = GetProfileInt("Settings", "yPos", -1);
m_b12HourBase = GetProfileInt("Settings", "12HourBase", TRUE);
m_iSnap = GetProfileInt("Settings", "Snap", 1);
/*
Adjust the position of window to the screen.
The window size is the same as the frame-bitmap size.
*/
RECT rDesktop;
SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID) &rDesktop, 0);
CRect wr(0, 0, GetSystemMetrics(SM_CXSCREEN), rDesktop.bottom);
if ((m_xPos + 377) > wr.Width())
m_xPos = wr.Width() - 377;
if ((m_yPos + 130) > wr.Height())
m_yPos = wr.Height() - 130;
pAlarmApp = this;
m_pMainWnd = new CAlarmWnd(); // Create window.
m_pMainWnd->ShowWindow(SW_SHOW); // Make visible.
m_pMainWnd->UpdateWindow(); // Force refresh.
return TRUE; // Report success.
}
/////////////////////////////////////////////////////////////////////////////
// CAlarmApp commands
int CAlarmApp::ExitInstance()
{
WriteProfileInt("Settings", "WindowIsTopmost", m_bWindowIsTopmost);
WriteProfileInt("Settings", "SpeakClock", m_bSpeakClock);
WriteProfileInt("Settings", "Style", m_iStyle);
WriteProfileInt("Settings", "AlarmActive", m_bAlarmActive);
WriteProfileInt("Settings", "Alarm24Hour", m_iAlarm24Hour);
WriteProfileInt("Settings", "AlarmMinute", m_iAlarmMinute);
WriteProfileInt("Settings", "GrayLetters", m_bGrayLetters);
WriteProfileInt("Settings", "SpeakIntervals", m_iSpeakIntervals);
WriteProfileInt("Settings", "xPos", m_xPos);
WriteProfileInt("Settings", "yPos", m_yPos);
WriteProfileInt("Settings", "12HourBase", m_b12HourBase);
WriteProfileInt("Settings", "Snap", m_iSnap);
return CWinApp::ExitInstance();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -