Can orphaned user pinned Windows 7 taskbar shortcuts be cleared programmatically? - windows-7

Here is the scenario:
In the Wix install script for our application , start menu shortcuts and desktop shortcuts are now handled differently than before.
These changes causes any user pinned shortcut to the application on the taskbar to be orphaned when a user runs an update from a previous installation. In other words, the shortcut remains but is no longer pointing to anything.
The shortcut is shown as a blank page indicating that the link has been removed. A quick peek at the C:\Users[UserName]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar folder confirms this. Clicking on the shortcut will remove it and then show a windows dialog asking whether to remove the shortcut or not (answer has no meaning since it has already been removed).
My question is:
Is there any way to tell the taskbar to remove orphaned shortcuts ?
Preferrably this would be triggered by a custom action in the Wix script after installing the new version.

The roaming profile can move from machine to machine so it's pretty much impossible. About all you could do is leave behind a component that runs on logon and detects that your app is no longer installed and deletes the shortcuts.
I'd consider this user data and let the user worry about it.

Related

Hide console when running shortcut pinned to taskbar

I'm trying to create a shortcut (.lnk) file that will launch scrcpy without showing the console window, but I need to be able to pin it to the taskbar and have the window and shortcut merge. Scrcpy is bundled with a vbs script that launches scrcpy through wscript, hiding the console, but when I made a shortcut opening that through wscript that made a duplicate window (icon?). I also found a somewhat promising question here about Pinning advertised shortcuts on the taskbar, which led me to an MS Docs page about AppUserModelIds, the only problem being I don't really understand how they work, or how to make a shortcut with them.

Windows script to run at shutdown

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.

Windows or Windows Installer Not Updating Program Icon on Application Search

I'm using wix (3.11) to create a msi installation for a WPF application. The application icon is correctly working on program launch, in the program list (apps and features), and in my program menu and desktop shortcuts. The only issue is that when I search for the application after pressing the windows key, the older, stale icon that I used a few weeks ago appears. I'm almost certain that this is some windows caching issue as I have removed the stale icon from the application altogether, rebuilt the installer and reinstalled, and still the old icon appears during search. I'm curious if other members have encountered this issue and what they did to remedy it. Thanks!
Not sure if you need to rebuild the icon cache or fix indexing issues.
For Indexing:
Type "indexing" in the start menu (or internationalized equivalent word), Click open.
Click the Advanced button.
In the Index Settings tab, click the Rebuild button under Troubleshooting. OK to confirm.
Index rebuilding should start. This Indexing applet is also available from the old-style control panel in "icons" view. Just search for "control panel" or equivalent internationalized words.
One liner code (one effective line and boiler) to refresh icons: https://github.com/crazy-max/IconsRefresh

How can I disable / permanently hide the taskbar in Windows 7?

I would like to completely remove the Windows 7 taskbar, including tray and start-button, so that the user can not reactivate it by pressing the Windows-key on the keyboard. however, all other explorer functionality (i.e. starting an explorer Window using Windows+E) should remain.
Is it possible to permanently hide the complete taskbar? Maybe there are some registry values on could change in order to make that behaviour selectable using a powershell script?
Thanks a lot
Here be my solution (it hides rather than replaces or removes the native taskbar - this allows it to work with programs that have a dependency on the native taskbar, such as display fusions taskbar).
disable-taskbar-always-top
Still to solve: [HALF SOLVED]
Eliminate the stupid line that auto-hide leaves with some maximized applications, such as Google Chrome
HALF SOLUTION -
If you move the taskbar to the left or right edge prior to doing the above steps, you don't get the stupid auto-hide line at the top or bottom of Google Chrome. Since the native taskbar is not mouse sensitive anymore, it won't impact your use of hot corners, or multi monitors (for instance I have the native taskbar on the left of my middle monitor, and it does not popup when moving between monitors using the steps in this post).
Okay, I think I have finally - finally - got a workaround that:
Keeps the native Windows 7/8 taskbar hidden for your session (you do have a couple of steps you need to do on start-up each time, or if you manually un-hide the taskbar).
Prevents the native Windows 7/8 taskbar from opening with popups or programs seeking attention (flashing taskbar thing).
Prevents the native taskbar from being mouse sensitive (i.e. despite auto-hide, it will not appear when you mouse over the hidden taskbar anymore).
Allows you to use the screen area that is occupied by the native taskbar (this is the problem of not combining Taskbar-Hide with the autohide setting; you can't use that screen real-estate).
Allows you to run alternative taskbars that are dependent on keeping the native taskbar functional (for instance Dislay Fusions Multi-Monitor Taskbar + [Settings >> Advanced Settings ?> 'Show On All Montiors'])
One Time Steps:
1) Download and run this registry edit to prevent balloon notification popups from the native taskbar/system tray:
Notifications - Enable or Disable Message Balloons - Windows 7 Help Forums
(You can open this in notepad to see what changes it will make prior to installing it, if you want).
2) Download and run Taskbar-Hide from here:
Hide Taskbar: Hide Taskbar in Windows 8 | 7 with a hotkey
3) Set the taskbar to auto-hide
Optional:
3) B) Add a shortcut to Taskbar-Hide.exe in your startup folder, to have it launch automatically with windows on startup (you still need to use the Ctrl+Esc hotkeys to activate the functions of taskbar-hide - though you could also script this if you were really keen).
Startup Folder:
C:\Users{User Name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Steps to hide taskbar after each start-up or manually un-hiding using Taskbar-Hide
4) Make sure Taskbar-Hide is running.
5) Make sure the taskbar is in its auto-hide state (i.e. you'll have to look at any programs that are currently seeking attention).
6) Once the taskbar is 'auto-hidden', press the hotkeys for Taskbar-Hide (Ctrl+Esc)
[This should mean that the native taskbar area is no longer sensitive to mouse activity]
One way is to replace the explorer shell with your own shell. This is the a common method done in Windows 7 Embedded.
In older versions of Windows (such as XP) it was possible to specifiy a shell for each user via regedit. I am not sure this is easily possible in Windows 7.
See https://superuser.com/questions/352865/how-do-i-change-the-windows-shell-for-only-one-user
Make an empty exe file and use it as the file to use in your "Custom User Interface" group policy. Additional information here.
I have found another solution that works nearly perfect for me, by just hiding the Taskbar and the Start button by simply sending both the WM_HIDE message:
Handle = FindWindow("Shell_TrayWnd", "");
...
ShowWindow(Handle, SW_SHOW);
The only problem I have with that solution is that the taskbar is not hidden permanently, i.e. as soon as one element is activated that does not have the focus, which on the taskbar leads to the item flashing in yellow, the taskbar gets visible again.
I'm not sure if there is a way to prevent Windows from re-enabling the visible flag of the taskbar in some way, or a method to hook to the SW_SHOW in C# though.

Windows Form App Deployment/Installation

I have a Windows form app that I've published but the end result is not what I've expected. After the wizard finishes, I click on the setup.exe and the application installs and launches, but I don't see any shortcuts in the All Programs. The application is listed in Programs and Features but when I close the app, there is no icon to click to launch it again. I've searched for an executable file in the Program Files and System32 folders found nothing.
So what I wanted to to do is create a desktop shrtcut, or shortcut in the All Programs as part of the installation process.
Also how do I assign a custom icon that will show up in the task bar?
Thanks,
Risho
create-setup-and-deployment-of-wpf-application-step-by-step
Is very helpful link for new users. Wpf and windows Forms are not much different in Deployment.
Assuming you are talking about ClickOnce publishing, you can ensure that desktop shortcuts and start menu shortcuts are created by selecting the 'The application is available offline as well (launchable from start menu)' radio button in the publish tab of the project properties, and clicking the 'Create desktop shortcut' checkbox in the Publish Options window.
I figured it out. For some reason, Visual Studio used the registered name under which it was installed, which is my employer, to create a shortcut on the All Programs and dropped the program shortcut there.
I also found in the project property page where to set the desktop icon.
Man, I'm good - sheesh! (JK)
Have great day.

Resources