3

I have come across a question on this site that mentions the possibility of UI hanging when the SystemEvents.UserPreferenceChanged event is fired. Now, I have not experienced this in my application, but I would like to test whether this bug might be lurking undetected in my code until it is too late.

However, despite doing some searching, I cannot seem to find comprehensive documentation regarding what causes the SystemEvents.UserPreferenceChanged event to be fired.

What are some (all?) system events that cause it to be fired? Is it just a wrapper for the WM_SETTINGCHANGE message, or is there more to the story? What settings can I change to cause it to be fired?

MathuSum Mut
  • 2,765
  • 3
  • 27
  • 59
  • https://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.userpreferencechanged(v=vs.110).aspx – Samvel Petrosov Jul 15 '17 at 10:12
  • 2
    By most common reason for the deadlock it causes is a switch to the secure desktop. Press the Win+L keys. – Hans Passant Jul 15 '17 at 10:42
  • 1
    @SamvelPetrosov the link you provide is indeed the SystemEvents.UserPreferenceChanged Event documentation, but that documentation lacks any examples of what causes the event to be invoked. Hence I too had to search, and found the answer here. – Reg Edit Oct 02 '20 at 20:28

1 Answers1

7

According to this MSDN Link. UserPreferenceChanged Event may occur when one of the Events in the below categories are triggered!. This is for a class of type UserPreferenceChangedEventArgs. I think the Description is self explanatory and clear.

enter image description here

Suraj S
  • 1,019
  • 7
  • 18
  • Thanks, this is what is needed. For some reason it is lacking from the documentation for both [SystemEvents.UserPreferenceChanged Event](https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.systemevents.userpreferencechanged) and [UserPreferenceChangedEventArgs Class](https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.userpreferencechangedeventargs). Fortunately you persisted and found it in the doc for [UserPreferenceCategory Enum](https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.userpreferencecategory) – Reg Edit Oct 02 '20 at 20:37