mirror of
https://github.com/modernw/AppInstallerForWin8.git
synced 2026-04-14 20:58:19 +10:00
添加项目文件。
This commit is contained in:
34
ToastNotification/AddPackageSample.cpp
Normal file
34
ToastNotification/AddPackageSample.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||
//// PARTICULAR PURPOSE.
|
||||
////
|
||||
//// Copyright (c) Microsoft Corporation. All rights reserved
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PackageManager.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
void callback (unsigned progress)
|
||||
{
|
||||
std::cout << '\r' << progress << "%" << std::ends;
|
||||
}
|
||||
|
||||
[MTAThread]
|
||||
int __cdecl main(Platform::Array<String^>^ args)
|
||||
{
|
||||
wcout << L"Copyright (c) Microsoft Corporation. All rights reserved." << endl;
|
||||
wcout << L"Add Package" << endl << endl;
|
||||
|
||||
if (args->Length < 2)
|
||||
{
|
||||
wcout << L"Usage: addpkg.exe packageUri" << endl;
|
||||
return 1;
|
||||
}
|
||||
HANDLE completedEvent = nullptr;
|
||||
int returnValue = 0;
|
||||
String^ inputPackageUri = args[1];
|
||||
cout << endl;
|
||||
AddPackageFromPath (inputPackageUri->Data (), &callback);
|
||||
return 0;
|
||||
}
|
||||
39
ToastNotification/README.txt
Normal file
39
ToastNotification/README.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
Add Package Sample
|
||||
====================
|
||||
This sample demonstrates how to use IPackageManager to install a package.
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
This sample requires Windows 8.1+.
|
||||
This sample requires Visual Studio 12 Ultimate Developer Preview.
|
||||
This sample requires the Windows Runtime Software Development Kit.
|
||||
|
||||
Sample Language Implementations
|
||||
===============================
|
||||
C++
|
||||
|
||||
Files:
|
||||
======
|
||||
AddPackageSample.cpp
|
||||
|
||||
To build the sample using the command prompt:
|
||||
=============================================
|
||||
1. Open the Command Prompt window and navigate to the directory.
|
||||
2. Type msbuild AddPackageSample.sln.
|
||||
|
||||
|
||||
To build the sample using Visual Studio 12 Ultimate Developer Preview (preferred method):
|
||||
================================================
|
||||
1. Open File Explorer and navigate to the directory.
|
||||
2. Double-click the icon for the .sln (solution) file to open the file in
|
||||
Visual Studio.
|
||||
3. In the Build menu, select Build Solution. The application will be
|
||||
built in the default \Debug or \Release directory.
|
||||
|
||||
|
||||
To Run the sample:
|
||||
==================
|
||||
1. Open a command prompt.
|
||||
2. Navigate to the directory containing AddPackageSample.exe
|
||||
2. Type AddPackageSample.exe "<uri-of-package>" at the command line.
|
||||
For example, AddPackageSample.exe "file://C|/users/testuser/desktop/testpackage.appx"
|
||||
226
ToastNotification/ToastNotification.cpp
Normal file
226
ToastNotification/ToastNotification.cpp
Normal file
@@ -0,0 +1,226 @@
|
||||
#include "stdafx.h"
|
||||
#include "ToastNotification.h"
|
||||
|
||||
bool SaveIStreamToTempFile (IStream* stream, wchar_t* tempFilePath, size_t pathLen)
|
||||
{
|
||||
wchar_t tempPath [MAX_PATH];
|
||||
if (!GetTempPathW (MAX_PATH, tempPath)) return false;
|
||||
if (!GetTempFileNameW (tempPath, L"TST", 0, tempFilePath)) return false;
|
||||
std::ofstream outFile (tempFilePath, std::ios::binary);
|
||||
if (!outFile) return false;
|
||||
// 读取 IStream 数据
|
||||
STATSTG stat;
|
||||
HRESULT hr = stream->Stat (&stat, STATFLAG_NONAME);
|
||||
if (FAILED (hr)) return false;
|
||||
LARGE_INTEGER liZero = {};
|
||||
stream->Seek (liZero, STREAM_SEEK_SET, nullptr);
|
||||
ULARGE_INTEGER remaining = stat.cbSize;
|
||||
BYTE buffer [4096];
|
||||
ULONG bytesRead;
|
||||
while (remaining.QuadPart > 0)
|
||||
{
|
||||
hr = stream->Read (buffer, min (sizeof (buffer), remaining.LowPart), &bytesRead);
|
||||
if (FAILED (hr) || bytesRead == 0) break;
|
||||
outFile.write ((char*)buffer, bytesRead);
|
||||
remaining.QuadPart -= bytesRead;
|
||||
}
|
||||
return outFile.good ();
|
||||
}
|
||||
|
||||
// 线程安全删除临时文件
|
||||
void DeleteFileThreadSafe (wchar_t* filePath)
|
||||
{
|
||||
Sleep (5000); // 等待通知可能完成显示
|
||||
DeleteFileW (filePath);
|
||||
}
|
||||
|
||||
bool CreateToastNotification (
|
||||
LPCWSTR identityName,
|
||||
LPCWSTR title,
|
||||
LPCWSTR text,
|
||||
NOTICE_PRESS_CALLBACK callback,
|
||||
HISTREAM imgFile
|
||||
)
|
||||
{
|
||||
ComPtr <IToastNotifier> notifier;
|
||||
ComPtr <IToastNotification> toast;
|
||||
ComPtr <IToastNotificationFactory> toastFactory;
|
||||
ComPtr <IXmlDocument> xmlDoc;
|
||||
HRESULT hr = RoInitialize (RO_INIT_MULTITHREADED);
|
||||
if (FAILED (hr) && hr != RPC_E_CHANGED_MODE) return false;
|
||||
ComPtr <IToastNotificationManagerStatics> toastManager;
|
||||
hr = RoGetActivationFactory (HStringReference (L"Windows.UI.Notifications.ToastNotificationManager").Get (),
|
||||
__uuidof(IToastNotificationManagerStatics),
|
||||
&toastManager);
|
||||
if (FAILED (hr)) return false;
|
||||
hr = toastManager->CreateToastNotifierWithId (HStringReference (identityName).Get (), ¬ifier);
|
||||
if (FAILED (hr)) return false;
|
||||
hr = RoActivateInstance (HStringReference (L"Windows.Data.Xml.Dom.XmlDocument").Get (), &xmlDoc);
|
||||
if (FAILED (hr)) return false;
|
||||
wchar_t xmlTemplateWithImage [] =
|
||||
L"<toast>"
|
||||
L"<visual>"
|
||||
L"<binding template='ToastImageAndText02'>"
|
||||
L"<image id='1' src='file://%s'/>"
|
||||
L"<text id='1'>%s</text>"
|
||||
L"<text id='2'>%s</text>"
|
||||
L"</binding>"
|
||||
L"</visual>"
|
||||
L"</toast>";
|
||||
wchar_t xmlTemplateNoImage [] =
|
||||
L"<toast>"
|
||||
L"<visual>"
|
||||
L"<binding template='ToastGeneric'>"
|
||||
L"<text>%s</text>"
|
||||
L"<text>%s</text>"
|
||||
L"</binding>"
|
||||
L"</visual>"
|
||||
L"</toast>";
|
||||
wchar_t xmlData [1024];
|
||||
wchar_t imagePath [MAX_PATH] = L"";
|
||||
if (imgFile != NULL)
|
||||
{
|
||||
IStream* img = (IStream*)imgFile;
|
||||
STATSTG stat;
|
||||
hr = img->Stat (&stat, STATFLAG_DEFAULT);
|
||||
if (SUCCEEDED (hr) && stat.pwcsName)
|
||||
{
|
||||
wcscpy_s (imagePath, stat.pwcsName);
|
||||
CoTaskMemFree (stat.pwcsName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SaveIStreamToTempFile (img, imagePath, MAX_PATH)) return false;
|
||||
wchar_t* tempFileCopy = _wcsdup (imagePath);
|
||||
if (tempFileCopy)
|
||||
{
|
||||
CreateThread (nullptr, 0, (LPTHREAD_START_ROUTINE)DeleteFileThreadSafe, tempFileCopy, 0, nullptr);
|
||||
}
|
||||
}
|
||||
swprintf_s (xmlData, xmlTemplateWithImage, imagePath, title, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s (xmlData, xmlTemplateNoImage, title, text);
|
||||
}
|
||||
ComPtr <IXmlDocumentIO> xmlDocIO;
|
||||
hr = xmlDoc.As (&xmlDocIO);
|
||||
if (FAILED (hr)) return false;
|
||||
hr = xmlDocIO->LoadXml (HStringReference (xmlData).Get ());
|
||||
if (FAILED (hr)) return false;
|
||||
hr = RoGetActivationFactory (HStringReference (L"Windows.UI.Notifications.ToastNotification").Get (),
|
||||
__uuidof(IToastNotificationFactory),
|
||||
&toastFactory);
|
||||
if (FAILED (hr)) return false;
|
||||
hr = toastFactory->CreateToastNotification (xmlDoc.Get (), &toast);
|
||||
if (FAILED (hr)) return false;
|
||||
return SUCCEEDED (notifier->Show (toast.Get ()));
|
||||
}
|
||||
|
||||
HRESULT CreateShortcutWithAppIdA (LPCSTR pszShortcutPath, LPCSTR pszTargetPath, LPCSTR pszAppId)
|
||||
{
|
||||
HRESULT hr;
|
||||
// 初始化 COM
|
||||
hr = CoInitialize (NULL);
|
||||
if (FAILED (hr))
|
||||
return hr;
|
||||
// 创建 IShellLink 对象(ANSI版本)
|
||||
IShellLinkA* pShellLinkA = NULL;
|
||||
hr = CoCreateInstance (CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_IShellLinkA, (void**)&pShellLinkA);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
// 设置快捷方式目标路径
|
||||
hr = pShellLinkA->SetPath (pszTargetPath);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
pShellLinkA->Release ();
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
// 设置 AppUserModelID
|
||||
IPropertyStore* pPropStore = NULL;
|
||||
hr = pShellLinkA->QueryInterface (IID_IPropertyStore, (void**)&pPropStore);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
PROPVARIANT propvar;
|
||||
hr = InitPropVariantFromString (_bstr_t (pszAppId), &propvar);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
// PKEY_AppUserModel_ID 定义在 propkey.h 中
|
||||
hr = pPropStore->SetValue (PKEY_AppUserModel_ID, propvar);
|
||||
if (SUCCEEDED (hr))
|
||||
hr = pPropStore->Commit ();
|
||||
PropVariantClear (&propvar);
|
||||
}
|
||||
pPropStore->Release ();
|
||||
}
|
||||
// 保存快捷方式文件(IPersistFile 要求传入宽字符串)
|
||||
IPersistFile* pPersistFile = NULL;
|
||||
hr = pShellLinkA->QueryInterface (IID_IPersistFile, (void**)&pPersistFile);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
// 将 pszShortcutPath 从 ANSI 转换为 Unicode
|
||||
wchar_t wszShortcutPath [MAX_PATH];
|
||||
MultiByteToWideChar (CP_ACP, 0, pszShortcutPath, -1, wszShortcutPath, MAX_PATH);
|
||||
hr = pPersistFile->Save (wszShortcutPath, TRUE);
|
||||
pPersistFile->Release ();
|
||||
}
|
||||
pShellLinkA->Release ();
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CreateShortcutWithAppIdW (LPCWSTR pszShortcutPath, LPCWSTR pszTargetPath, LPCWSTR pszAppId)
|
||||
{
|
||||
HRESULT hr;
|
||||
hr = CoInitialize (NULL);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
return hr;
|
||||
}
|
||||
IShellLinkW* pShellLinkW = NULL;
|
||||
hr = CoCreateInstance (CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&pShellLinkW);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
hr = pShellLinkW->SetPath (pszTargetPath);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
pShellLinkW->Release ();
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
IPropertyStore* pPropStore = NULL;
|
||||
hr = pShellLinkW->QueryInterface (IID_IPropertyStore, (void**)&pPropStore);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
PROPVARIANT propvar;
|
||||
hr = InitPropVariantFromString (pszAppId, &propvar);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
hr = pPropStore->SetValue (PKEY_AppUserModel_ID, propvar);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
hr = pPropStore->Commit ();
|
||||
}
|
||||
PropVariantClear (&propvar);
|
||||
}
|
||||
pPropStore->Release ();
|
||||
}
|
||||
IPersistFile* pPersistFile = NULL;
|
||||
hr = pShellLinkW->QueryInterface (IID_IPersistFile, (void**)&pPersistFile);
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
hr = pPersistFile->Save (pszShortcutPath, TRUE);
|
||||
pPersistFile->Release ();
|
||||
}
|
||||
pShellLinkW->Release ();
|
||||
CoUninitialize ();
|
||||
return hr;
|
||||
}
|
||||
17
ToastNotification/ToastNotification.h
Normal file
17
ToastNotification/ToastNotification.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#ifdef TOASTNOTICE_EXPORTS
|
||||
#define TOASTNOTICE_API __declspec(dllexport)
|
||||
#else
|
||||
#define TOASTNOTICE_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
typedef void (*_NOTICE_PRESS_CALLBACK) (void);
|
||||
typedef _NOTICE_PRESS_CALLBACK NOTICE_PRESS_CALLBACK;
|
||||
// ʹÓà COM ´´½¨µÄ IStream *
|
||||
typedef HANDLE HISTREAM;
|
||||
|
||||
extern "C" TOASTNOTICE_API bool CreateToastNotification (LPCWSTR identityName, LPCWSTR title, LPCWSTR text, NOTICE_PRESS_CALLBACK callback, HISTREAM imgFile);
|
||||
extern "C" TOASTNOTICE_API HRESULT CreateShortcutWithAppIdA (LPCSTR pszShortcutPath, LPCSTR pszTargetPath, LPCSTR pszAppId);
|
||||
extern "C" TOASTNOTICE_API HRESULT CreateShortcutWithAppIdW (LPCWSTR pszShortcutPath, LPCWSTR pszTargetPath, LPCWSTR pszAppId);
|
||||
20
ToastNotification/ToastNotification.sln
Normal file
20
ToastNotification/ToastNotification.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 12
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ToastNotification", "ToastNotification.vcxproj", "{59131AB7-2A7D-9A09-8223-174C3F5E0F57}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
170
ToastNotification/ToastNotification.vcxproj
Normal file
170
ToastNotification/ToastNotification.vcxproj
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{E10C6272-B876-4DC6-9E13-7CA646863B50}</ProjectGuid>
|
||||
<ProjectName>ToastNotification</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ReferencePath>$(VCINSTALLDIR)\vcpackages;$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;$(WindowsSdkDir)\References\CommonConfiguration\Neutral</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ReferencePath>$(VCINSTALLDIR)\vcpackages;$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;$(WindowsSdkDir)\References\CommonConfiguration\Neutral</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ReferencePath>$(VCINSTALLDIR)\vcpackages;$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;$(WindowsSdkDir)\References\CommonConfiguration\Neutral</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ReferencePath>$(VCINSTALLDIR)\vcpackages;$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;$(WindowsSdkDir)\References\CommonConfiguration\Neutral</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;TOASTNOTICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<AdditionalOptions>/ZW:nostdlib /FUplatform.winmd /FUwindows.winmd %(AdditionalOptions)</AdditionalOptions>
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>NotSet</SubSystem>
|
||||
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;TOASTNOTICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<AdditionalOptions>/ZW:nostdlib /FUplatform.winmd /FUwindows.winmd %(AdditionalOptions)</AdditionalOptions>
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>NotSet</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<AdditionalOptions>/ZW:nostdlib /FUplatform.winmd /FUWindows.winmd %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<AdditionalOptions>/ZW:nostdlib /FUplatform.winmd /FUWindows.winmd %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ToastNotification.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ToastNotification.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
23
ToastNotification/stdafx.h
Normal file
23
ToastNotification/stdafx.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include <wrl.h>
|
||||
#include <windows.ui.notifications.h>
|
||||
#include <windows.data.xml.dom.h>
|
||||
#include <stdio.h>
|
||||
#include <shobjidl.h>
|
||||
#include <wrl/client.h>
|
||||
#include <fstream>
|
||||
#include <propvarutil.h>
|
||||
#include <propkey.h>
|
||||
#include <wrl.h>
|
||||
#include <string>
|
||||
#include <shlobj.h>
|
||||
#include <propkey.h>
|
||||
#include <comdef.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace ABI::Windows::UI::Notifications;
|
||||
using namespace ABI::Windows::Data::Xml::Dom;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
Reference in New Issue
Block a user