|
|
private: int DialogWidth ; int DialogHeight; }; |
void CWakeMeUp1Dlg::OnBnClickedSet() { // TODO: Add your control notification handler code here // Get the screen dimensions DialogWidth = GetSystemMetrics(SM_CXSCREEN); DialogHeight = GetSystemMetrics(SM_CYSCREEN); // When sets the clock CD, remove the title bar and the borders LONG ptrStyles = GetWindowLong(this->m_hWnd, GWL_STYLE); ptrStyles &= ~WS_TILEDWINDOW; SetWindowLong(this->m_hWnd, GWL_STYLE, ptrStyles); // Occupy the whole screen SetWindowPos(&wndTopMost, 0, 0, DialogWidth, DialogHeight, SWP_SHOWWINDOW); // This will represent the dimensions of the whole screen CRect rctClient; // Get a reference to the device context CClientDC dc(this); // Create a black brush CBrush BlackBrush(RGB(0, 0, 0)); // Select the black brush CBrush *pOldBrush = dc.SelectObject(&BlackBrush); // Get the dimension of the current dialog box GetClientRect(&rctClient); // Paint the dialog box in black dc.Rectangle(rctClient); // Restore the original brush dc.SelectObject(pOldBrush); // Start the timer control SetTimer(IDC_CHECKTIME, 400, 0); // We don't need to see the cursor ShowCursor(FALSE); } |
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #pragma once #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. #define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. #define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. #define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. #endif #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit // turns off MFC's hiding of some common and often safely ignored warning messages #define _AFX_ALL_WARNINGS #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #include <afxdisp.h> // MFC Automation classes #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT #include <Mmsystem.h> |
void CWakeMeUp1Dlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CTime tmeCurrent = CTime::GetCurrentTime(); if( tmeCurrent == CTime(tmeCurrent.GetYear(), tmeCurrent.GetMonth(), tmeCurrent.GetDay(), HOUR, MINUTE, 0, 0) ) { char strSender[] = "play cdaudio"; mciSendString(strSender, NULL, 0, NULL); } CDialog::OnTimer(nIDEvent); } |
void CWakeMeUp1Dlg::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here // Stop the CD char strSender[] = "stop cdaudio"; mciSendString(strSender, NULL, 0, NULL); // Stop the timer KillTimer(IDC_CHECKTIME); } |
// WakeMeUp1Dlg.h : header file // #pragma once #include "atltime.h" #include "afxdtctl.h" // CWakeMeUp1Dlg dialog class CWakeMeUp1Dlg : public CDialog { // Construction public: CWakeMeUp1Dlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_WAKEMEUP1_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() private: int DialogWidth ; int DialogHeight; public: afx_msg void OnBnClickedSet(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnDestroy(); CDateTimeCtrl m_TimeToWakeUp; CTime tmeSet; }; |
void CWakeMeUp1Dlg::OnBnClickedSet() { // TODO: Add your control notification handler code here // Get the time that the user had set and store it this->m_TimeToWakeUp.GetTime(tmeSet); // Get the screen dimensions DialogWidth = GetSystemMetrics(SM_CXSCREEN); DialogHeight = GetSystemMetrics(SM_CYSCREEN); // When sets the clock CD, remove the title bar and the borders LONG ptrStyles = GetWindowLong(this->m_hWnd, GWL_STYLE); ptrStyles &= ~WS_TILEDWINDOW; SetWindowLong(this->m_hWnd, GWL_STYLE, ptrStyles); // Occupy the whole screen SetWindowPos(&wndTopMost, 0, 0, DialogWidth, DialogHeight, SWP_SHOWWINDOW); // This will represent the dimensions of the whole screen CRect rctClient; // Get a reference to the device context CClientDC dc(this); // Create a black brush CBrush BlackBrush(RGB(0, 0, 0)); // Select the black brush CBrush *pOldBrush = dc.SelectObject(&BlackBrush); // Get the dimension of the current dialog box GetClientRect(&rctClient); // Paint the dialog box in black dc.Rectangle(rctClient); // Restore the original brush dc.SelectObject(pOldBrush); // Start the timer control SetTimer(IDC_CHECKTIME, 400, 0); // We don't need to see the cursor ShowCursor(FALSE); } |
void CWakeMeUp1Dlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CTime curTime = CTime::GetCurrentTime(); if( curTime == tmeSet ) { char strSender[] = "play cdaudio"; mciSendString(strSender, NULL, 0, NULL); } CDialog::OnTimer(nIDEvent); } |
|
||
Home | Copyright © 2005 FunctionX, Inc. | |
|