I' building a webapp that reads the database based on time to check changes. When there is a change, a notification in windows displays so the user is notified.
Chrome-> Dots menu-> More settings-> Create shortcut (as window) (Roghly Translated)
The problem is that the user needs to have the webapp opened so it is working and doing the before mentioned task. I thought a solution could be to run the shorcut on startup as a service or something (maybe in the icons next to the taskbar clock). But I don't know if this is the best approach or how to do that.
That's why I'm asking for help to find the best approach and if it is the one I'm thinking, to know how could I do that.
Related
i have been trying to get a windows startup/shutdown sound to play, i couldn't get the sounds to play so i asked on Microsoft, here is the link https://answers.microsoft.com/en-us/windows/forum/all/cannot-change-windows-start-up-sound/8bbcb0a0-1402-4f1e-b080-9c8d526bc205
and i was told that its not possible. well too bad because i am not going to stop there, so i went to local group policy editor on windows 10 where you can choose scripts to run during shutdown and start up. i then wrote a very small PowerShell command with the file name of "shutdown.ps1" the code inside of shutdown.ps1 is
start "C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown\TADA.wav"
this file is located in the C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown directory along with the TADA.wav file that it plays when it shuts down.
now the issue i am having is that when windows is shutting down, its ending all processes so it does not play the sound. what can i do to change that?
I'm pretty new to all of this and am very grateful for any input you can give.
thanks in advance,
Devin
From How to Change the Windows 10 Logoff, Logon, and Shutdown Sounds in Windows 10:
...
While you can still customize what sounds sounds play for most OS events, Windows 10 hid shut down, logoff, and logon from view. They’re still around, though. You just need to make a few mild changes in the Windows Registry to get them back.
Add the Actions Back to the Sound Control Panel by Editing the Registry
To add the shutdown, logoff, and logon actions back to the menu in the Sound Control Panel app, you just need to make a few little tweaks in the Windows Registry.
...
Open the Registry Editor by hitting Start and typing “regedit.” Press Enter to open Registry Editor and then give it permission to make changes to your PC.
In the Registry Editor, use the left sidebar to navigate to the following key:
HKEY_CURRENT_USER\AppEvents\EventLabels
You’re going to be making one small change in each of three different subkeys inside that EventLabels key. First, we’ll tackle the shutdown sound or, as Windows likes to call it, System Exit. Under the EventLabels key on the left side of Registry Editor, select the SystemExit subkey. On the right side, double-click the ExcludeFromCPL value.
Note that by default, the value is 1, meaning that the action is excluded from the Control Panel. Change the value to 0 and then click “OK.”
Next, you’re going to make exactly the same change in two other subkeys inside the EventLabels key: WindowsLogoff and WindowsLogon. Head into each of those folders, open the ExcludeFromCPL value inside, and change the value from 1 to 0.
No need to restart Windows. You can go ahead and test your changes right away. Open up the Sound Control Panel app by right-clicking the speaker icon in your Notification Area and selecting “Sounds.” 1
You should now see the new actions (Exit Windows, Windows Logoff, and Windows Logon) available in the selection window and you can assign whatever sounds you like to those actions.
If, for whatever reason, you want to hide those actions from the Control Panel again, just head back into Registry Editor and change each of those ExcludeFromCPL values back to 1.
1: On my machine, to get to the Sounds control panel, I had to go into the Settings, choose "Personalization", then "Themes", then `Sounds".
UPDATE:
And indeed, all three sound events show up in my Sounds control panel once I re-enable them in the Registry. However, I tried assigning audio files to them, and although Windows remembered the assignments, nothing played when invoking those actions.
So, I guess the playback functionality is simply not implemented for those events anymore. This seems to be confirmed in your discussion with a Microsoft Insider on answers.microsoft.com (with an 89% upvote rate of 143K replies, I would think he knows what he's talking about):
In Windows 10 there is no way to change the Windows Startup Sound, that sound is set permanently in a DLL in Windows, it is not an audio file like the other system sounds, and even when you turn on the Startup sound on that dialog, sometimes the startup sound will play and other times it will not, this is a known bug in Windows 10, which seems to have been fixed in Windows 11
Windows10 does not support a shutdown sound like previous versions of Windows, you wil find many methods posted online, sadly, none of them work.
I'm a developer and a long-time Windows user with an obsession about making my system as convenient to use as possible.
Yesterday I thought about something that has always annoyed me in Windows and that I've taken for granted, and I realized that I have a better idea for how it could work, and I'm now wondering whether it's possible to tweak Windows to work like that.
The thing that annoys me is when windows steal focus. For example, I could be running an installer for some program. While it's working, I'll switch to my browser and browse, maybe entering some text into an email in my browser. Then suddenly the installer finishes and its window steals the focus. Now I'm in the middle of writing an email, so I might press a key that happens to be bound to a button on that installer, and then that button gets invoked, doing some action that I never intended to happen!
This is doubly annoying to me because I'm using a multiple-desktop program called DexPot, and when a window steals focus, it also brings itself to the desktop I'm currently on, which can be really annoying, because then I have to put it back into its original desktop.
How my ideal solution to this problem would work: Every time a window tries to steal focus, we intercept that, and don't let it. We show something like a toaster message saying "Foobar installer wants focus, press Win-Whatever to switch to it". If and when you press the key combo, it switches to the window.
The question is: Is there an easy way to tweak Windows to make this happen? I know very little about Windows programming. I do know AHK and if it's possible with that, that'd be great.
No, there isn't an easy way to add this behavior, but Windows tries to do this automatically.
In theory apps shouldn't be able to steal the foreground while you're actively using another app. Unfortunatly there are some scenarios where Windows can't tell the difference between legitimate user actions that should change the foreground and unwanted foreground-theft. The window manager generally tightens up the holes a bit with each new version of Windows, but also needs to make sure that apps can come to the foreground when the user wants them to, even if that desire is expressed indirectly.
For example, a process launched by the current foreground process can put a window into the foreground. This is necessary so that when a user launches a window from Explorer the newly launched process can open its main window. This permission only lasts until the next user input, so if an application is slow to launch and you start working on an email the app may lose its foreground permissions before it can use them.
See the SetForegroundWindow function documentation for a list of requirements for a process to be able to set a window into the foreground.
There are also apps which specifically make use of these requirements to steal the permission (by joining the foreground queue or synthsising user input to themselves), but I suspect in your installer scenario it is accidental.
I'm not sure what exactly is going on, but I suspect that the problem comes from the installer running as a service and accidentally stealing the foreground permission when it tries to launch the app on your current desktop.
It would be theoretically possible for an external process to hook into the foreground system to override this and show your confirmation toast, but it would be tricky to get right and would require significant low level code (I'd probably start with a CbtHook). It would not be possible in a scripting package like AHK (assuming you mean AutoHotKey) but would need to be native C/C++ code injected into every running process.
I have a friend who's working at a company that offers pretty poor support for its developers (scoring a 1/12 on the Joel Test).
Their build process is locked down pretty tight, and depending on the size of project it could take 40+(x2) mouse clicks to deploy. So I thought, "Hey, why not automate it the clicks using the win32api?" (Specifically using Python). I've got him a real nice tool that works just fine except for one issue - the tool that they use has a navigation pane that may or may not be open.
You can open and close it with a button press, but I'm not sure how I could make sure it was either open or closed. It's irrelevant to the build process - the only problem is that it alters where the mouse needs to click on the screen depending on its open status. The application is written in .NET and it exposes a function call that applications are able to use to toggle the panel, so I've been looking around for ideas and so far I've got two of them:
Attach to the process via a debugger and execute the function call somehow.
Take a screenshot at the location of the panels titlebar (which I've got through the win32 API and doesn't appear to change regardless if the panel is hidden or not).
Is there an easier way to figure out the state of this panel? The developers are given an admin account on their machine in addition to their regular account, so I can entertain ideas that require admin access, though I don't think that should be necessary?
UPDATE:
It looks like there's a button that can close the pane. In UIAVerify something shows up as "text" "Navigation" "btnClose". It says its AutomationId is btnClose but it's a ControlType.Text
What technology is this panel built from? Is it standard GDI or WPF? If its GDI, it should have a HWND. You should be able to find this HWND through either a class name or window title. Once you have the HWND, you can get its width.
If its built with WPF, er, I have no idea, but Snoop does this kind of thing, so I know its possible.
I want to respond to a certain type of new window being opened by an external application. I have some experience finding applications and windows currently open (system wide) using some of the carbon functionality, so could theoretically just check every few seconds. This would require getting a list of all open windows and checking it against some list I would have to maintain, and feels very clunky.
How can I get a simple, clean notification when a new window is launched? Should I use the accessibility API? If so, what specifically am I looking for?
First, create an AXObserver. Then, watch for launches of any applications that you think you'd be interested in. When such a launch occurs, create an application AXUIElement for that process, and add your observer to it for the kAXWindowCreatedNotification notification.
I question whether this is the best way to do whatever you're trying to do. You might step back a bit from this solution (that is, watching for new windows) and ask another question about your goal.
new Windows 7 hides systray icons by default.
what is the recommended way to show information to users now?
I need to have a small clickable icon visible to user so user can access my "tool" anytime. Should I use the gadget to show my GUI instead? Can it communicate with my Delphi app somehow?
Without more information it's a little difficult to provide a recommendation.
However, I would imagine that a sufficiently important tool, the user would simply keep minimized. They could then use Jumplists to access quick functionality.
For example, Live Messenger uses this setup on Win7.
If your users really like your icon/application they can always choose to not hide your application.
The only difference is that only the user can choose which icon is shown, instead of every application claiming it's "real estate".
In my opinion this is a good functionality and if I were you I wouldn't change the application, just provide a first run GUI which explains how to make your tray icon visible in windows 7.
The entire reason why change was made, was to stop programs like yours. If you need to show information, go ahead and do so. But the notification areas ("systray") is not where shortcuts go. For that, you've got the start menu, desktop and/or the quick launch bar (and please let the user decide).