Desktop Win10 Toast Notification active callback not firing
The question is that: I have a WPF application and want to send a Win10 Style notification.
I searched all the website I know and find the MSDN way to do that: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop.
But unfortunately, I'm not using a Wix Installer, so I managed to create the shortcut in an other way: IShellLinkW.
So far, I succeed in sending a Toast. but I can't get a callback when operating on it.
My create short cut code:
using (PropVariant appId = new PropVariant(_aumid))
ErrorHelper.VerifySucceeded(newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5), appId)
);
It works well,so the SetValue method should be OK
I think I can hock the callback method with its GUID in the same way:
var toastclass = typeof(T).GUID.ToString();
using (PropVariant toastid = new PropVariant(toastclass))
toastid.SetEnum(VarEnum.VT_CLSID);
ErrorHelper.VerifySucceeded
(
newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 26), toastid
)
);
ErrorHelper.VerifySucceeded(newShortcutProperties.Commit());
I register it this way
// Register type
var regService = new RegistrationServices();
regService.RegisterTypeForComClients
(
typeof(T),
RegistrationClassContext.LocalServer,
RegistrationConnectionType.MultipleUse
);
_registeredActivator = true;
but finally the callback method not firing
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
[Guid("9a88b91d-f9c4-4c63-91dd-175c2c2cb458"), ComVisible(true)]
public class AreaIconToast : NotificationActivator
{
c# wpf desktop windows-10-desktop
add a comment |
The question is that: I have a WPF application and want to send a Win10 Style notification.
I searched all the website I know and find the MSDN way to do that: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop.
But unfortunately, I'm not using a Wix Installer, so I managed to create the shortcut in an other way: IShellLinkW.
So far, I succeed in sending a Toast. but I can't get a callback when operating on it.
My create short cut code:
using (PropVariant appId = new PropVariant(_aumid))
ErrorHelper.VerifySucceeded(newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5), appId)
);
It works well,so the SetValue method should be OK
I think I can hock the callback method with its GUID in the same way:
var toastclass = typeof(T).GUID.ToString();
using (PropVariant toastid = new PropVariant(toastclass))
toastid.SetEnum(VarEnum.VT_CLSID);
ErrorHelper.VerifySucceeded
(
newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 26), toastid
)
);
ErrorHelper.VerifySucceeded(newShortcutProperties.Commit());
I register it this way
// Register type
var regService = new RegistrationServices();
regService.RegisterTypeForComClients
(
typeof(T),
RegistrationClassContext.LocalServer,
RegistrationConnectionType.MultipleUse
);
_registeredActivator = true;
but finally the callback method not firing
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
[Guid("9a88b91d-f9c4-4c63-91dd-175c2c2cb458"), ComVisible(true)]
public class AreaIconToast : NotificationActivator
{
c# wpf desktop windows-10-desktop
add a comment |
The question is that: I have a WPF application and want to send a Win10 Style notification.
I searched all the website I know and find the MSDN way to do that: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop.
But unfortunately, I'm not using a Wix Installer, so I managed to create the shortcut in an other way: IShellLinkW.
So far, I succeed in sending a Toast. but I can't get a callback when operating on it.
My create short cut code:
using (PropVariant appId = new PropVariant(_aumid))
ErrorHelper.VerifySucceeded(newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5), appId)
);
It works well,so the SetValue method should be OK
I think I can hock the callback method with its GUID in the same way:
var toastclass = typeof(T).GUID.ToString();
using (PropVariant toastid = new PropVariant(toastclass))
toastid.SetEnum(VarEnum.VT_CLSID);
ErrorHelper.VerifySucceeded
(
newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 26), toastid
)
);
ErrorHelper.VerifySucceeded(newShortcutProperties.Commit());
I register it this way
// Register type
var regService = new RegistrationServices();
regService.RegisterTypeForComClients
(
typeof(T),
RegistrationClassContext.LocalServer,
RegistrationConnectionType.MultipleUse
);
_registeredActivator = true;
but finally the callback method not firing
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
[Guid("9a88b91d-f9c4-4c63-91dd-175c2c2cb458"), ComVisible(true)]
public class AreaIconToast : NotificationActivator
{
c# wpf desktop windows-10-desktop
The question is that: I have a WPF application and want to send a Win10 Style notification.
I searched all the website I know and find the MSDN way to do that: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop.
But unfortunately, I'm not using a Wix Installer, so I managed to create the shortcut in an other way: IShellLinkW.
So far, I succeed in sending a Toast. but I can't get a callback when operating on it.
My create short cut code:
using (PropVariant appId = new PropVariant(_aumid))
ErrorHelper.VerifySucceeded(newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5), appId)
);
It works well,so the SetValue method should be OK
I think I can hock the callback method with its GUID in the same way:
var toastclass = typeof(T).GUID.ToString();
using (PropVariant toastid = new PropVariant(toastclass))
toastid.SetEnum(VarEnum.VT_CLSID);
ErrorHelper.VerifySucceeded
(
newShortcutProperties.SetValue
(
new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 26), toastid
)
);
ErrorHelper.VerifySucceeded(newShortcutProperties.Commit());
I register it this way
// Register type
var regService = new RegistrationServices();
regService.RegisterTypeForComClients
(
typeof(T),
RegistrationClassContext.LocalServer,
RegistrationConnectionType.MultipleUse
);
_registeredActivator = true;
but finally the callback method not firing
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
[Guid("9a88b91d-f9c4-4c63-91dd-175c2c2cb458"), ComVisible(true)]
public class AreaIconToast : NotificationActivator
{
c# wpf desktop windows-10-desktop
c# wpf desktop windows-10-desktop
edited Nov 15 '18 at 6:28
Blacktempel
2,88831739
2,88831739
asked Nov 15 '18 at 2:13
Theta YTheta Y
163
163
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Finally I solved this problem, I find it is beacuse I pass CLSID in string format when creating the shortcut,but the right way is to pass it as byte ,so that's why the callback method don't work.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311465%2fdesktop-win10-toast-notification-active-callback-not-firing%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Finally I solved this problem, I find it is beacuse I pass CLSID in string format when creating the shortcut,but the right way is to pass it as byte ,so that's why the callback method don't work.
add a comment |
Finally I solved this problem, I find it is beacuse I pass CLSID in string format when creating the shortcut,but the right way is to pass it as byte ,so that's why the callback method don't work.
add a comment |
Finally I solved this problem, I find it is beacuse I pass CLSID in string format when creating the shortcut,but the right way is to pass it as byte ,so that's why the callback method don't work.
Finally I solved this problem, I find it is beacuse I pass CLSID in string format when creating the shortcut,but the right way is to pass it as byte ,so that's why the callback method don't work.
answered Feb 9 at 13:26
Theta YTheta Y
163
163
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311465%2fdesktop-win10-toast-notification-active-callback-not-firing%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown