I managed to send Toast messages but once clicked, the callback is not invoked. This is the toast-tutorial that was used.
The messages should be sent through classic Win32 and in order to do this, a shortcut needs to be created which contains the AUMID and the CLSID. This is explained in Step 5 of the tutorial, where for MSIX and WiX these id's are put in their config files. There isn't an explanation how to generate the shortcut in Win32, but can be found in another aumid-tutorial.
After following the steps provided, sending the toast works fine, but clicking it does not invoke the callback for handling the feedback.
One thing that stands out, is that the installShortcut function uses only the AUMID in the creation of the shortcut, the CLSID is only used when registering the COM Server, where the configuration for MSIX and WIX shortcuts use both.
It seems as there is the link missing that windows needs to route the feedback back into the app.
Toasts use the "ToastGeneric" binding.
Any idea why this is happening?
Just on the name alone it seems to me like you need to set the PKEY_AppUserModel_ToastActivatorCLSID property on the .lnk and not just the AUMID.
MSDN says:
Used to CoCreate an INotificationActivationCallback interface to notify about toast activations.
This page is marked as pre-release but does have a different InstallShortcut function that sets this property.
I have run the desktop-toasts sample successfully. As the code comment comments,
For the app to be activated from Action Center, it needs to provide a
COM server to be called when the notification is activated. The CLSID
of the object needs to be registered with the OS via its shortcut so
that it knows who to call later. The WiX installer adds that to the
shortcut. Be sure to install the app via the WiX installer once before
debugging!
If running the package project directly, It also works. The following picture shows What happens when I installed DesktopToastsCppWrlApp.msi generated by Wix Toolset.
Related
I have created a File Explorer context menu extension that uses the IExplorerCommand interface to add menu commands to the Windows 11 context menu.
This has been working fine, but after the last Windows update, it no longer works properly.
Although the menu commands still appear, nothing happens when I click on any of them. I've added logging and I can see that IExplorerCommand::Invoke() is no longer being called.
Strangely, if I select the "Show more options" menu to get the legacy Windows 10 context menu, the commands work fine from that menu, it is only in the new Windows 11 context menu that they don't work.
I have tried running File Explorer in a debugger while selecting my menu commands, and I get lines like this in the output window when I click on the command:
onecore\com\combase\dcomrem\stdid.cxx(726)\combase.dll!00007FF9EB9947F5: (caller: 00007FF9C22E1E38) ReturnHr(2627) tid(67bc) 8001010E The application called an interface that was marshalled for a different thread.
I'm guessing this is the reason why my commands are not being called. Does anyone have any suggestions for what is causing this? Could it be a bug in File Explorer?
I've tried both STA and MTA threading models, and changing this made no difference.
Well, after wasting hours on this I finally have a solution!
My code was based on the PhotoStoreContextMenu sample code here:
https://github.com/microsoft/AppModelSamples/tree/master/Samples/SparsePackages/PhotoStoreContextMenu
This uses the Windows Runtime C++ Template Library (WRL), and defines the base classes used by the class like this:
class TestExplorerCommandBase : public RuntimeClass<RuntimeClassFlags<ClassicCom>, IExplorerCommand, IObjectWithSite>
The change that fixed it for my code was to use WinRtClassicComMix instead of ClassicCom, i.e.
class TestExplorerCommandBase : public RuntimeClass<RuntimeClassFlags<WinRtClassicComMix>, IExplorerCommand, IObjectWithSite>
I'm pretty sure this problem started when I installed KB5019509, which is the Windows update that changes File Explorer so that it now has tabs.
Note: this problem only happens for IExplorerCommands created in the plug-in for submenus, the top level commands that are defined in the APPX file work fine.
Also note that although this change does fix the problem with Invoke() not being called, it does introduce a new problem which is that IOleWindow::GetWindow() no longer works so it is not possible to get the parent HWND. (See Calling IOleWindow::GetWindow() from IExplorerCommand::Invoke() is giving error 8001010d (RPC_E_CANTCALLOUT_ININPUTSYNCCALL)).
I have a NPAPI plugin running in Safari, Chrome and Firefox. I'm able to handle all key combinations with the event callback, but the problem I'm having is with certain key combinations.
In the plugin, I'm trying to use Command+O to fire the plugin's file open dialog, but the browser is also firing its open file dialog.
Supposedly, returning TRUE for event handling method should report the browser that the plugin handled the event, but I'm having no luck with that.
You neglected to specify which OS you're on; based on the fact that you said "Command+O" instead of "Ctrl-O" I'm assuming you're on Mac. The bad news is that on Mac, all events are passed to the plugin from the browser. If the browser doesn't choose to make it possible to override the handling of an event (and it sounds like this is the case) then there is probably nothing you can do about it, short of possibly using some OS hook to intercept the key event before the browser gets it, which seems risky.
On windows you might have a little more luck, since a windowed plugin should actually get events first before they are passed to the parent window and thus could intercept them. On Mac, though, it's all windowless and you get events when the browser feels like giving them to you.
tortoiseSVN has a shell hook that add overlay icons on files.
They create a separate open source project to use it in their commons projects (tortoiseSvn,tortoiseGit,etc)
i've download the installer .msi from google code that install the hooker handler
i've got my own version of "IShellIconOverlayIdentifier::IsMemberOf" that use for the handlers
how i grab all together ?
Here is the only doc i found
Please note that the TortoiseOverlays handler does not reduce the work you have to do: you have to implement your own overlay handler and get it to work fully. Only then can you make use of the TortoiseOverlays handler if you still want to:
The purpose of the TortoiseOverlays handler is to share the handler slots the windows shell has (limited to 15). It's not to help you implement overlay handlers.
Once you have your own handler working, you can simply change the registry keys where you register your own handler. After that, TortoiseOverlays will be loading your overlay handler.
I've been working on a project that will need a notifier in the system tray (sorry, "System Notification Area"). It will be a simple app that just generates popup notifications when it receives a message via a Zeromq socket.
I am not having any luck finding anything other than .NET resources and examples. Does anyone have a sample in C/C++?
I would start with this section of MSDN: Notifications and the Notification Area.
Then I'd check the NotificationIcon Sample in the Windows SDK.
What framework are you using? There should probably be several implementations for MFC, but there might different implementation for WTL and other frameworks. If you want to use the Windows API with no object orientation - well, you won't need any wrapper library then, but you can look at these libraries for example.
Here's one that has MFC and non-MFC version from CodeProject:
http://www.codeproject.com/KB/shell/systemtray.aspx
What you want here is probably ShowBalloon() function, which shows a balloon notification, but I'm pretty sure you must create a tray icon for that (can't have a notification balloon without having a tray icon).
I have a carbon C++ application and I would like to programmatically do the equivalent of Command-H (to hide the application) which is available in the Application menu for my app. I have explored the carbon API for TransitionWindow and HideWindow and while these can hide my window, they do not do the equivalent of Command-H. I looked into the AppleEvent reference on the offhand I needed to create an AppleEvent but I didn't see one for hide application. Any thoughts?
Sorry to answer my own question but the ShowHideProcess() API seems to do what I want. If there are better solutions I would love to hear them.
Just a note: hiding a Window is very different to hiding an Application.
You can also send a kHICommandHide ('hide') command event from the Carbon Event Manager (which is what that menu item does, and which calls ShowHideProcess() when processed) if you prefer, for instance if you'd like this action to be materialised by an event.
I looked into the AppleEvent reference on the offhand I needed to create an AppleEvent but I didn't see one for hide application. Any thoughts?
I'm no expert but you can just use AppleEvent to set the visible property of a process to false – at least it works with an AppleScript
tell application "System Events"
set visible of process "xyz" to false
end tell
On the other hand, your API seems to be the most direct way and the above code probably just uses it as well.