Bypass windows file assignation reset - c#

i am developing a music player in C# winforms.
My program has code which sets the .mp3 files deafult app to my program.
The code works but everytime it runs, windows resets the app:
(dont mind the extension in the image i got it from the internet cuz i wasnt able to screenshot it on my pc)
Is there a way to bypass this reset?

Since Windows 10, you cannot change the default application of a file type programmatically. The user is meant to change by himself the default programs from and only from the OS.
You can see the "Important" note in the MS doc : https://learn.microsoft.com/en-US/windows/win32/shell/default-programs?redirectedfrom=MSDN

Related

WPF C# OpenFileDialog does not show Network Storage

At the moment i am working on a C# WPF-Project. It uses the Microsoft.Win32.OpenFileDialog and the System.Windows.Forms.FolderBrowserDialog, which both work as expected except for the following problem:
They both do not show my Networkdrives!
While the default Windows explorer (Win 8.1 btw.) and the OpenFileDialog in an older Winforms-Project do show all the devices, the WPF Application only shows local drives.
I have no Idea why this happens and how to fix it. Any ideas?
Apparently this happens when the application runs with elevated permissions like bernd commented on my question.
Look at this MSDN Post for all the details.

get status info Windows Media Player (stand-alone application)

I want to write an application which gets the status information about a running WMP thread, like playing/paused, shuffle mode on/off, repeat on/off, song title or media file path.
I was using the P/Invoke SendMessage-function to "simulate" a click on the play/pause/stop etc. buttons, but I'm unable read the values of labels/text boxes inside the WMP application with WM_GETTEXT.
I used Spy++ to get the handles of certain text fields - but they (obviously) change their handle after restarting the WMP.
Does somebody know a answer to this Problem?
It could be anything - P/Invoke or SendKeys - but not this AxWindowsMediaPlayer, because my application is a console app and I want the status information of the external process - not of my own.
Thanks
I will mark this thread as 'answered'.
I have solved this problem a few months ago, but lost the source code.
The aim of this application is to control the WMP via sshd or telnet.
You can download the binaries here if you want to:
WMP.rar (27 KB)
https://mega.co.nz/#!ug5DySRR!rQlI9OZZ8wYq7yAqaH-KYsmCl9LSaBjNdvqX0g_WDtI
The application is executed via console. You can see the commands by typing >wmp help

Hard Error for password box on Windows Standard Embedded 7

I am working on a C# application for a Windows Standard Embedded 7 platform. I have managed to create a Windows image (using Image Configuration Editor) and installed the .NET 4.5 runtime, as well as the application software. All good so far.
When I run the program, all looks well - the hardware initializes correctly and the software loads its data. However, when I go to the program's "login" dialog (an otherwise ordinary WPF dialog window that gives access to extended functionality), something odd happens. The dialog has a PasswordBox in it, and when I click (or tab focus) to that box, the software crashes with a system message box saying "Unknown Hard Error". There's no real clue as to why this happens, and it is 100% repeatable. Any ideas? Any ideas on how to diagnose the problem?
This turns out to be a problem with fonts (!). You need to include TrueType fonts in the Image Configuration Editor when building an IBW image for Windows Standard Embedded 7, it will NOT get picked up as a dependency in the .NET 4.x template.

How can I place a Desktop App shortcut on the Windows 8 Start screen without using an installer?

My Desktop Application is just a single exe file. For reasons that aren't important, I can't use an installer which would add an icon to the Windows 8 Start screen. Can one be added programatically with C#?
Thanks
If you right click on the exe you can click pin-to start
This worked for my example in the image, which is a stand-alone exe without any sort of installation. It will then appear on the start bar.
Hope this helps.
EDIT: I realized after that you said programmatically.
It looks like a link to the start page is put in C:\Users[UserName]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
So perhaps you could tell it to deposit a short cut there?
EDIT 2 this previous question may also be helpful: Creating application shortcut in a directory. It is in C#
Take a look at the code samples for enabling desktop notifications, a prerequisite of which is the existence of a shortcut installed to the Start screen. The sample is C++ w/COM, but you should be able to incorporate this small bit into a C# app (or rewrite the sample code in C# directly).

How to place 90X90 icon

i am creating .cab file installer for windows mobile application,
problem is i need to keep the 90X90 .png image as icon for application.
as per the link
i tried to load the icon,step am following are
1) writing the icon path to registry
2) then loading the icon...
i followed the step mentioned above link,
but the problem is i need to restart my device or emulator to get the 90X90 png icon..
i dont no what is the reason... every time i need to restart..
please let me know, how to fix this probme.. and let me know the reson why its appearing.
The Windows Mobile shell caches the icon. On your first install on a clean device, your icon will be used. After that, the icon will remain in the cache until the device is reset, so if you want to change an icon with an already-installed app, you have to soft reset to force the shell to reload the cache.
Again, this is only a problem when changing the icon for an already-installed app. It's not going to affect your users when they are installing it on a clean device (and therefore probably is not an issue for you at all).

Categories