屏蔽Devexpress 试用窗口

    xiaoxiao2021-03-26  20

    不用说了,这个试用窗口真心非常讨厌。

    先说下原理

       如果长期使用Devexpress就会知道,Devexpress 实际上每30分钟就会弹出一次试用窗口,还没啥好办法屏蔽。

       后来通过分析Dev的代码发现,他存储的时间实际是在

       注册表的[HKEY_CURRENT_USER\SOFTWARE\DevExpress\Components]节点下存放的。

      "SmartTagWidth"="350"   "LastAboutShowedTime"="02/05/2017 10:41:32"   "DisableSmartTag"="False"

      子节点LastAboutShowedTime 就是上次显示关于窗口的时间,如果一直更新这个时间,这样不就不会显示试用窗口啦!(当前时间-LastAboutShowedTime的绝对值大于30分钟就会显示,这是我反编译Dev的源代码发现的)

      废话不多说,上代码

    public class SetNoDisplay { private const string Data= "SOFTWARE\\DevExpress\\Components"; private const string keys = "LastAboutShowedTime"; private const string formate = "MM/dd/yyyy HH:mm:ss"; private const string disable = "DisableSmartTag"; private const string SmartTagWidth = "SmartTagWidth"; public void SetDate() { CreateKey(); try { RegistryKey regkey = Registry.CurrentUser; var key = regkey.OpenSubKey(Data, true); var value = key.GetValue(keys); var date = DateTime.Now.ToString(formate); key.SetValue(keys, date); regkey.Dispose(); } catch { } } private void CreateKey() { try { RegistryKey regkey = Registry.CurrentUser; var data = regkey.OpenSubKey(Data, true); if (data == null) { var subkey = regkey.CreateSubKey(Data); subkey.CreateSubKey(keys).SetValue(keys, DateTime.Now.ToString(formate)); subkey.CreateSubKey(disable).SetValue(keys, false); subkey.CreateSubKey(SmartTagWidth).SetValue(keys, 350); } regkey.Dispose(); } catch { } } public SetNoDisplay() { Task.Factory.StartNew(()=> { while (true) { SetDate(); Thread.Sleep(TimeSpan.FromSeconds(15)); } }); } }使用方法,在App应用中,直接New 一个SetNoDisplay就好了,就这么简单。

    转载请注明原文地址: https://ju.6miu.com/read-660012.html

    最新回复(0)