定时提醒小程序

功能点:

  1. 定时消息提醒
  2. 定时音乐提醒
  3. 定时关机
  4. 获取开机时间

截图:

源代码:

[cpp]  view plain  copy  print ?

  1. #include <windows.h>  
  2. #include <WindowsX.h>  
  3. #include <CommCtrl.h>  
  4. #include "resource.h"  
  5.   
  6. #include "mmsystem.h"   
  7. #pragma comment(lib,"winmm.lib")  
  8.   
  9. #define Method_AlertMessage  50000  
  10. #define Method_ShutDown      50001  
  11. #define Method_AlertMusic1   50002  
  12. #define Method_AlertMusic2   50003  
  13.   
  14. #define IDT_TIME1            101  
  15.   
  16. // Data  
  17. HICON g_hIconLarge;  
  18. HICON g_hIconSmall;  
  19. BSTR g_strStarTime;   //get Start Computer Time  
  20. BSTR g_strSpaceTime;  // set the alert Time  
  21. BSTR g_strAlertMessage; //the alert message variable  
  22. NOTIFYICONDATA g_pnid;  //the notify icon data variable  
  23. HWND g_hWndBegin, g_hWndStop, g_hWndSet,g_hWndMessage;          // take turns the HWND begin, stop, set, Dialog  
  24. HINSTANCE g_hInstance;   // the instance of the Main Windows  
  25. HWND g_hWndMain;         // the HWND of the Main Windows  
  26. int g_iSpaceTime,g_iSpaceTimeForTimer,g_iAlertMethod;    //take turns is the space time, space time for Timer, alert method  
  27. HWND hWndSetSpTime,hWndAlertMetod;   // the the set Dialog two combobox HWND  
  28.   
  29.   
  30.   
  31. LRESULT CALLBACK DialogProc(HWND ,UINT,WPARAM,LPARAM) ;  
  32. BOOL    CALLBACK SetDlgProc(HWND ,UINT,WPARAM,LPARAM);  
  33. void OnInitDialog(HWND hDlg);  
  34. void WMSet(HWND hDlg);    //设置  
  35. void WMBegin(HWND hDlg);   //开始  
  36. void WMStop(HWND hDlg);    //停止  
  37. void ToOurTray(HWND hDlg);  //托盘最小化  
  38. void DeleteOurTray(HWND hDlg); //删除托盘最小化  
  39. void ShutDown(HWND hDlg);      //关机  
  40. void AlertMessageFunc(int );    //消息提醒  
  41.   
  42.   
  43. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)         
  44. {   
  45.     g_hIconLarge = static_cast<HICON>(LoadImage(hInstance, TEXT("IDI_ICON1"), IMAGE_ICON,  //set large ico  
  46.         GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CXICON), 0));  
  47.     g_hIconSmall = static_cast<HICON>(LoadImage(hInstance, TEXT("IDI_ICON1"), IMAGE_ICON,   //set small ico  
  48.         GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0));  
  49.     g_hInstance = hInstance;  
  50.   
  51.     MSG msg;  
  52.   
  53.     HWND hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc);             
  54.     g_hWndMain = hwnd;  
  55.     ShowWindow(hwnd, SW_SHOW);         
  56.     Up
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lengyue815

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值