- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要让我的 vb.net 应用程序能够在应用程序中收到通知时闪烁/闪烁以吸引用户的注意力。
就像这张图片中的 DW 图标一样:
我已经在谷歌上搜索了一段时间并尝试了各种代码示例,但都没有成功。
这是我到目前为止所得到的:
Public Class FlashWindow
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Shared Sub main()
FlashWindow(Me.Handle, 1)
End Sub
End Class
'Me' is valid only within an instance method
最佳答案
首先 Me
用于引用当前类。当该代码在 Form 类中时,它具有属性 Handle
。在您的示例中,FlashWindow 类没有属性 Handle,因此无法编译。
其次,我认为您对 API 函数的定义有点偏离。
将此类添加到您的项目中:
Public Class WindowsApi
Private Declare Function FlashWindowEx Lib "User32" (ByRef fwInfo As FLASHWINFO) As Boolean
' As defined by: http://msdn.microsoft.com/en-us/library/ms679347(v=vs.85).aspx
Public Enum FlashWindowFlags As UInt32
' Stop flashing. The system restores the window to its original state.
FLASHW_STOP = 0
' Flash the window caption.
FLASHW_CAPTION = 1
' Flash the taskbar button.
FLASHW_TRAY = 2
' Flash both the window caption and taskbar button.
' This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
FLASHW_ALL = 3
' Flash continuously, until the FLASHW_STOP flag is set.
FLASHW_TIMER = 4
' Flash continuously until the window comes to the foreground.
FLASHW_TIMERNOFG = 12
End Enum
Public Structure FLASHWINFO
Public cbSize As UInt32
Public hwnd As IntPtr
Public dwFlags As FlashWindowFlags
Public uCount As UInt32
Public dwTimeout As UInt32
End Structure
Public Shared Function FlashWindow(ByRef handle As IntPtr, ByVal FlashTitleBar As Boolean, ByVal FlashTray As Boolean, ByVal FlashCount As Integer) As Boolean
If handle = Nothing Then Return False
Try
Dim fwi As New FLASHWINFO
With fwi
.hwnd = handle
If FlashTitleBar Then .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_CAPTION
If FlashTray Then .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TRAY
.uCount = CUInt(FlashCount)
If FlashCount = 0 Then .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TIMERNOFG
.dwTimeout = 0 ' Use the default cursor blink rate.
.cbSize = CUInt(System.Runtime.InteropServices.Marshal.SizeOf(fwi))
End With
Return FlashWindowEx(fwi)
Catch
Return False
End Try
End Function
End Class
Dim res = WindowsApi.FlashWindow(Process.GetCurrentProcess().MainWindowHandle, True, True, 5)
关于.net - 如何在 vb.net 中闪烁/闪烁任务栏图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23565087/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我们有一个应用程序,它显示一个小的“总在最上面”窗口。一般来说,这工作得很好。与其他应用程序一样,当它处于事件状态时,任务栏将其显示为已选中。 现在将幻灯片模式下的 PowerPoint 添加到组合中
我刚刚用 java-swing 为我写了一个桌面时钟,我希望每次登录时该时钟都运行。 为此,我将我的 jar 文件添加到 start 文件夹,我让时钟开始运行。 但我的问题是 - 任务栏中显示的图标允
有谁知道如何在任务栏中为程序设置自定义图标? 我知道您可以创建程序的快捷方式,以便在程序的左上角获取您想要的任何图标(引用下图),但如何让程序在任务栏中获取新图标? 最佳答案 任务栏中显示的图标是可执
我想知道任何类型的 API 或解决方法(例如脚本或注册表),以将 Windows 任务栏移动(或调整大小)到另一个位置,包括另一个显示器(如果是双显示器)。当然,我们可以使用鼠标移动任务栏,但我想通过
如标题所示,是否有任何 Win32 API 可以做到这一点? 最佳答案 不要这样做。 我 99% 确信没有官方 API,这与没有 programmatic access to the old Star
我正在编写一个小程序来解决与 16 位程序的兼容性问题。此修复是关闭 explorer.exe,因为 explorer 会覆盖程序中的某些调色板。之后,我们重新打开资源管理器。 当使用 .bat 文件
Windows 7 任务栏按钮绘制在阴影背景上。颜色阴影以某种方式对鼠标在按钮上的位置使用react。 我想在我的应用程序中使用这样的按钮。我该怎么做? 最佳答案 也许试试 绘制主题背景 http:/
我正在尝试创建一个由在一个窗口中运行的选项卡(而不是浏览器选项卡)组成的任务栏。 我需要跟踪每个选项卡中发生的事情,每个选项卡都有单独的面包屑。(为此,我想也许在每个选项卡的浏览器中使用一个 cook
我创建了没有任务栏的 WinCE 6.0 镜像。所以所有应用程序都最大化到全屏。我想创建自己的应用程序,如任务栏。我只想向这个任务栏添加几个按钮。但我希望其他处于最大化模式的应用程序不要隐藏此任务栏。
我是中级 jquery 经验,所以我需要一个很棒的界面演示的帮助: Demo 但我不知道为什么它不拖到具有相同 ID 的“#drophere”的其他 div。请让它像 Windows 任务栏一样工作。
我正在使用 JFrame 为桌面应用程序创建 GUI。我使用此代码根据平台屏幕的分辨率设置的 GUI 的大小。 this.setSize(this.getToolkit().getScreenSize
首先,我知道 SO 中有一个类似措辞的问题,但没有得到正确回答,围绕它的大部分讨论都落在了“你不应该那样做”上。 所以让我们从基础开始。为什么需要这个。 我在一家公司工作,该公司向我们的员工分发了几十
我想弄清楚如何在任务栏上显示进度。通过 PowerShell。 据我了解,我应该使用这样的东西: $Progress = [System.Windows.Shell.TaskbarItemInfo]:
是否可以从 Win7 任务栏捕获“实时”缩略图?我想在我的应用程序中显示此预览(另一个窗口的),但如何使用 .NET 提取这些预览? 最佳答案 是的。 MSDN Magazine explains h
我想在 C# 中模拟类似于 Windows 任务栏的东西。我想要一个表格底部的栏(我的意思是主表格)。当我打开新表格时,表格名称放在栏上,当我打开另一个新表格时,新表格名称放在栏上......另一方面
我使用 tabcontrols 创建了一个任务栏,它的工作方式与 Windows 任务栏类似。我想让我自己的任务栏固定在窗口的顶部。 它不应该是可移动的、可调整大小的,并且应该“停靠”到顶部。 最佳答
我们有一个主应用程序,它加载了几个插件,这些插件有自己的图标和子窗口。 问题出在 Windows 7 中,任务栏中的图标始终是主应用程序的图标,即使在子窗口中也是如此。但是,Alt+Tab 菜单会显示
我想为 Windows 制作一个二进制时钟。但我希望它替换默认时钟(有 2 个时钟不是最佳选择)。 因此,其中一种方法就是在旧时钟之上绘制我的二进制时钟。我怎么做?允许使用外部库。 我试过这样的东西:
为了简洁起见:我正在尝试实现 this使用 wxPython,但我正在努力将该代码放入基于 wxPython 的脚本中。 我的简单 PyQt 测试代码运行良好。这是: from PyQt4 impor
我是一名优秀的程序员,十分优秀!