Oke,所以我希望创建一个程序,在将鼠标移动到屏幕顶部之前,该程序将不可见。
我希望它像任务栏一样下来(如果你隐藏任务栏,当你把光标放在它应该的位置时,它会向上滑动)
我能想到的最好的方法是在我将某些东西拖到屏幕顶部之前,程序在任务栏中不可见。
我不知道是否有一个插件可以获得我想要的行为(当我靠近它时显示它)或者如果我需要自己创建该功能,我也不知道如何隐藏任务栏中的内容直到它被使用。
我确实知道如何将它从任务栏隐藏起来,这将是一个始终运行的服务(所以没有窗口)然后当鼠标到达屏幕顶部时它调用wpf应用程序并运行它。但也许有更好的方法来做到这一点。
我已经做了一些像行为一样的任务栏搜索,但它显得很空,我没有任何东西要显示,因为我不知道如何开始,对不起。
答案 0 :(得分:1)
来自CodeProject -- C-does-Shell-Part
您可以使用以下P / Invoke命令:
// Sends an appbar message to the system.
[DllImport("shell32.dll")]
public static extern UInt32 SHAppBarMessage(
UInt32 dwMessage, // Appbar message value to send.
ref APPBARDATA pData); // Address of an APPBARDATA structure.
// The content of the structure depends on the
// value set in the dwMessage parameter.
[StructLayout(LayoutKind.Sequential)]
public struct APPBARDATA
{
public UInt32 cbSize;
public IntPtr hWnd;
public UInt32 uCallbackMessage;
public UInt32 uEdge;
public RECT rc;
public Int32 lParam;
}
// The RegisterWindowMessage function defines a new window message that is
// guaranteed to be unique throughout the system. The message value can be
// used when sending or posting messages.
[DllImport("user32.dll")]
public static extern UInt32 RegisterWindowMessage(
[MarshalAs(UnmanagedType.LPTStr)]
String lpString); // Pointer to a null-terminated string that
// specifies the message to be registered.
这些允许将appbar消息发送到系统并控制工具栏的状态。有关更多详细信息,请参阅链接。