y-theta / deskbandtest Goto Github PK
View Code? Open in Web Editor NEWA Simple Deskband
A Simple Deskband
我写了这样一个类:
用它来测试windows消息。
这个类可以在CSDeskband中很好的运行,但是无法在您的DeskBandTest中运行。
using System;
using System.Windows;
using System.Windows.Interop;
namespace WMessager
{
public class WMessage
{
public event EventHandler reciveWMessage;
private int MESSAGENUMBER { get; set; }
public IntPtr Hwnd { get; set; }
public WMessage(object element, int message)
{
MESSAGENUMBER = message;
if (element is Window)
{ Hwnd = new WindowInteropHelper((Window)element).EnsureHandle(); }
else
{ Hwnd = ((HwndSource)PresentationSource.FromVisual((System.Windows.Media.Visual)element)).Handle; }
HwndSource.FromHwnd(Hwnd)?.AddHook(HwndHandler);
}
private IntPtr HwndHandler(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == MESSAGENUMBER)
{
this.reciveWMessage?.Invoke(this, new EventArgs());
}
handled = false;
return IntPtr.Zero;
}
}
}
这样使用这个类:
WMessage wMessage = new WMessage(this, 26); // 26是各种Windows消息
wMessage.reciveWMessage += borderBrushChange;
// WMessager 跟随系统改变颜色
private void borderBrushChange(object sender, EventArgs e)
{
Label.Text = "test";
}
我最近也在研究DeskBand
但是我不知道该如何debug它
每次都要将dll注册到Shell中运行起来,但是这样就没法debug了
您是如何做到的?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.