【发布时间】:2012-09-18 14:44:44
【问题描述】:
我似乎在任何地方都找不到这个看似简单的问题的答案 D:
我想检测一个窗体/窗口是否有焦点,以便我只能闪烁窗口如果没有焦点,这里是代码的一部分:
If Me.Focused = False Then ' Doesn't work D: please fix
Dim flash As New FLASHWINFO
flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash) '/// size of structure in bytes
flash.hwnd = MyBase.Handle '/// Handle to the window to be flashed
flash.dwFlags = FLASHW_ALL '/// to flash both the caption bar + the tray
flash.uCount = 5 '/// the number of flashes
flash.dwTimeout = 1000 '/// speed of flashes in MilliSeconds ( can be left out )
'/// flash the window you have specified the handle for...
FlashWindowEx(flash)
End If
有没有简单的方法来完成这项工作?
【问题讨论】:
-
你读过答案#2吗?即使那个答案不是 VB.NET 而是 C#,也不应该有真正的区别。
-
当你刚接触 VB 甚至还没有接触过 C# 时就不会
-
请阅读答案。答案 #1 与语言无关。答案 #2 向您展示了一个现成的 VB.NET 解决方案。那么你的问题出在哪里?