资源简介
C++的win10发送消息通知的例子,vs程序,必须要2015以上才能运行,toast通知是用xml文件定义的,xml文件可以自己修改

代码片段和文件信息
#include “stdafx.h“
#include “App.h“
#include “Toast++Dlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#pragma warning(suppress: 26433 26440)
BEGIN_MESSAGE_MAP(CToastPPApp CWinApp)
END_MESSAGE_MAP()
class CToastPPCommandLineInfo : public CCommandLineInfo
{
public:
//Constructors / Destructors
CToastPPCommandLineInfo() noexcept : m_bRegister(FALSE)
m_bUnRegister(FALSE)
{
}
//Methods
void ParseParam(const TCHAR* lpszParam BOOL bFlag BOOL bLast) override
{
if (bFlag)
{
CString sParamUpper(lpszParam);
sParamUpper.MakeUpper();
if (sParamUpper == _T(“REGSERVER“))
{
m_bRegister = TRUE;
m_bUnRegister = FALSE;
}
else if (sParamUpper == _T(“UNREGSERVER“))
{
m_bUnRegister = TRUE;
m_bRegister = FALSE;
}
else
__super::ParseParam(lpszParam bFlag bLast);
}
else
__super::ParseParam(lpszParam bFlag bLast);
};
//Member variables
BOOL m_bRegister;
BOOL m_bUnRegister;
};
CToastPPApp::CToastPPApp() noexcept : m_nExitCode(ERROR_SUCCESS)
{
}
#pragma warning(suppress: 26426)
CToastPPApp theApp;
BOOL CToastPPApp::InitInstance()
{
//Initialize the Windows Runtime
Microsoft::WRL::Wrappers::RoInitializeWrapper winRTInitializer(RO_INIT_MULTITHREADED);
{
HRESULT hr = winRTInitializer;
if (FAILED(hr))
{
CString sMsg;
sMsg.Format(_T(“Failed to initialize Windows Runtime Error:0x%08X“) hr);
AfxMessageBox(sMsg MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
//Get the executable path
std::wstring sModuleName;
hr = ToastPP::CManager::GetExecutablePath(sModuleName);
if (FAILED(hr))
{
CString sMsg;
sMsg.Format(_T(“Failed to get executable path Error:0x%08X“) hr);
AfxMessageBox(sMsg MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
//Parse the command line
CToastPPCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (cmdInfo.m_bRegister)
{
m_nExitCode = RegisterCOMServer(sModuleName.c_str());
return FALSE;
}
else if (cmdInfo.m_bUnRegister)
{
m_nExitCode = UnRegisterCOMServer();
return FALSE;
}
//Register for toast notifications
hr = ToastPP::CManager::RegisterForNotificationSupport(L“Toast++ Demo App“ sModuleName.c_str() L“Naughter.ToastPPDemoApp“ __uuidof(CToastNotificationActivationCallback));
if (FAILED(hr))
{
CString sMsg;
sMsg.Format(_T(“Failed to register for Toast Notifications Error:0x%08X“) hr);
AfxMessageBox(sMsg MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
//Register the class factories
m_nExitCode = RegisterActivator();
if (FAILED(hr))
return FALSE;
//Bring up the main dialog
CToastPPDlg mainDlg;
m_pMainWnd = &mainDlg;
m
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 21 2017-06-02 03:24 stdafx.cpp
文件 1700 2017-11-30 05:46 stdafx.h
文件 917 2014-10-09 03:09 naughter.css
文件 2089 2018-12-03 00:21 App.h
文件 729 2017-05-29 05:01 Resource.h
文件 314 2017-05-31 04:57 targetver.h
文件 80128 2018-12-03 01:34 Toast++.h
文件 1455 2018-12-02 20:37 Toast++Dlg.h
文件 5549 2018-12-03 00:11 app.cpp
文件 26420 2018-12-03 01:34 Toast++Dlg.cpp
文件 45085 2018-12-03 03:06 Toast++.htm
文件 2245 2018-12-02 23:56 Toast++Demo.sln
文件 3909 2017-06-04 02:31 Toast++Demo.rc
文件 18820 2018-12-02 23:56 Toast++Demo.vcxproj
文件 1994 2017-05-31 05:08 Toast++Demo.vcxproj.filters
目录 0 2018-12-03 02:14 ReleaseU\
文件 3281 2017-05-28 08:10 ReleaseU\100.jpg
文件 19430 2017-05-28 08:24 ReleaseU\180.jpg
文件 14954 2017-05-28 08:31 ReleaseU\202.jpg
文件 1278 2017-05-28 08:03 ReleaseU\64.jpg
文件 1358 2017-05-28 08:23 ReleaseU\65.jpg
文件 1425 2017-05-28 08:30 ReleaseU\66.jpg
文件 3878 2017-05-01 04:25 ReleaseU\cancel.png
文件 15875 2017-05-01 04:25 ReleaseU\Cloudy.png
文件 71194 2017-05-01 04:25 ReleaseU\Food1.jpg
文件 21975 2017-05-28 08:43 ReleaseU\IC601609.png
文件 3440 2017-05-01 04:25 ReleaseU\message.png
文件 19089 2017-05-01 04:25 ReleaseU\Mostly Cloudy.png
文件 4612 2017-05-01 04:25 ReleaseU\reminder.png
文件 37484 2017-05-01 04:25 ReleaseU\RestaurantMap.jpg
文件 2920 2017-05-01 04:25 ReleaseU\send.png
............此处省略7个文件信息
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- Win10数字权利激活自动批处理版2020-
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
评论
共有 条评论