Can I disable window autoplay function programatically with C#/.NET?

前端 未结 4 1951
無奈伤痛
無奈伤痛 2020-12-09 06:46

Does anybody know a way to deactivate the autoplay function of windows using c#/.NET?

4条回答
  •  星月不相逢
    2020-12-09 07:20

    RegisterWindowMessage is a Win32 API call. So you will need to use PInvoke to make it work..

    using System.Runtime.InteropServices;
    
    class Win32Call
    {
    [DllImport("user32.dll")]
       public static extern int RegisterWindowMessage(String strMessage);
    }
    
    // In your application you will call
    
    Win32Call.RegisterWindowMessage("QueryCancelAutoPlay");
    

    From here (The Experts-Exchange link at the top). There is additional help on that site with some more examples that may be a little more comprehensive than the above. The above does however solve the problem.

提交回复
热议问题