Question : I want to refresh the desktop in C#, I try to use IActiveDesktop::ApplyChanges but IActiveDesktop alias is not found as C# underlines it. What should I do?

Hi there;

I want to refresh the desktop in C#, I try to use IActiveDesktop::ApplyChanges but IActiveDesktop alias is not found as C# underlines it. What should I do?

The code I tried is:
IActiveDesktop::ApplyChanges(AD_APPLY_REFRESH);

I think I miss some reference but what should I import for it?
I write the above code it inside a function.

Best regards.

Answer : I want to refresh the desktop in C#, I try to use IActiveDesktop::ApplyChanges but IActiveDesktop alias is not found as C# underlines it. What should I do?

Or you can use the SHChangeNotify API.
[System.Runtime.InteropServices.DllImport("Shell32.dll")]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
with:
SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
Random Solutions  
 
programming4us programming4us