我似乎在任何地方都找不到这个看似简单的问题的答案 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
有没有一种简单的方法来完成这项工作?